decidim-plans 0.16.7 → 0.16.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 210bbe22dc50de4ec472503edc4ec7cc7944ccf4623cbd0602ba2f56ac73c59c
4
- data.tar.gz: 4b6ba7db25df3fc75fcd770511918ad71aeb38247769f0df384b2090f7d7d389
3
+ metadata.gz: 170eb87417645430c9d009737c52ae84141168dd7f493bd1e39edb9255b7bab9
4
+ data.tar.gz: 143a0c3f27aaf4ab7519acdaa21276c256fb77e9226ad46619161f4ae0824a3c
5
5
  SHA512:
6
- metadata.gz: a2c04c5480bad9093b12345eedb2ae702867fa770b3a76eb7b548349620492db1997091c453424f1e5b01f7640a7a404e13cb80d4d1790921bafce4faa4fd79e
7
- data.tar.gz: 374f57e0e4ce29c5ea888c631b3b6623251a24dbd58890292977d9f9dec60ff7631fb5ea57d781ec4e95b7a30ee20f59481e944826234b571d95a5c8bd2a2147
6
+ metadata.gz: d9fa85970c423d8d6452073255d26c33e100ace96feed0e9d22f924b93f6927ba415ee94effaf6e0319a6fd95c58c3cc45adc4757582f96f562a66d2eb4553cf
7
+ data.tar.gz: 60ff131f7331cab36ee5574bc64e7b15e120710945c535e30d6280f2b7af015e0bc57fa3da3e994e1eb5a6df1f53cf393de95fb8d690cc1768fe4edc9b2e424f
@@ -51,7 +51,7 @@ module Decidim
51
51
  on(:ok) do
52
52
  flash[:notice] = I18n.t("create.success", scope: i18n_flashes_scope)
53
53
 
54
- return redirect_to taggings_plan_path(plan) if @form.back_to_plan
54
+ return redirect_to taggings_plan_path(plan) if @form.back_to_plan == true
55
55
 
56
56
  redirect_to plan_tags_path(plan)
57
57
  end
@@ -79,7 +79,16 @@ module Decidim
79
79
  def search_tag_id
80
80
  return query unless tag_id.is_a? Array
81
81
 
82
- query.joins(:tags).where(decidim_plans_tags: { id: tag_id })
82
+ # Fetch the plan IDs as a separate query in order to avoid duplicate
83
+ # entries in the final result. We could also use `.distinct` on the
84
+ # main query but that would limit what the user could further on do with
85
+ # that query. Therefore, in this context it is safer to just fetch these
86
+ # in a completely separate query.
87
+ plan_ids = Plan.joins(:tags).where(
88
+ decidim_plans_tags: { id: tag_id }
89
+ ).distinct.pluck(:id)
90
+
91
+ query.where(id: plan_ids)
83
92
  end
84
93
 
85
94
  private
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Plans
5
- VERSION = "0.16.7"
5
+ VERSION = "0.16.8"
6
6
  DECIDIM_VERSION = "~> 0.16.0"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-plans
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.7
4
+ version: 0.16.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antti Hukkanen