decidim-comments 0.31.8 → 0.31.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc7a0ddffe6de6f6d7eed337a75fea555317a4e7ecb1718fe6c57cb3eca10c41
4
- data.tar.gz: ac33b8cc0f1dc52adf6191e41f5b901c7f12b308fdaa805404e130e225a79216
3
+ metadata.gz: 65af300fb66dfd9029000974453587cfaaaf8042ffa54fd9d7203c9470b6120a
4
+ data.tar.gz: 490288a1b6ddf401fb0c6070d7ab41688292c46c55b586901356af8a274409b9
5
5
  SHA512:
6
- metadata.gz: 8d04fa166dc529cd4e8dbe9bca659c85c72744d3a9f73cf1bc9f5bf4addd85a2611abf259a56f234dc768c5b8ef5e77159f4c83efeff94d55e081d169d61ab69
7
- data.tar.gz: 116e856f67bf8d938b069628e3acddaba8d44e9b18c974769f4efd63d33d4b0f55648b260de8536caef7788a9cdfeb28a09e03dcaf79119b3eb5e5fddafe4874
6
+ metadata.gz: 3a31e3e00e9c43e99b2d98370fc1452718d4938a241538f2ed0a5eee3299743a8ae92c070b1e7329ed2a63db250899e5aa26f7a802afb16c7ab371a19b5e117b
7
+ data.tar.gz: a73e31521d8ca9bac3c00edee24910fa3eb4ec784c7d040b0c7d8cdcadb0a3664dda52ad1c8a3212b661e84d3470968db7b32bfc821459109aba1f6134bed49f
@@ -134,14 +134,18 @@ module Decidim
134
134
 
135
135
  def set_commentable
136
136
  @commentable ||= if commentable_gid
137
- GlobalID::Locator.locate_signed(commentable_gid)
137
+ resource = GlobalID::Locator.locate_signed(commentable_gid)
138
+ ensure_in_organization!(resource)
139
+ resource
138
140
  elsif comment
139
141
  comment.root_commentable
140
142
  end
141
143
  end
142
144
 
143
145
  def set_comment
144
- @comment = Decidim::Comments::Comment.find_by(id: params[:id])
146
+ @comment = Decidim::Comments::Comment
147
+ .for_organization(organization: current_organization)
148
+ .find(params.require(:id))
145
149
  end
146
150
 
147
151
  def ensure_commentable!
@@ -34,7 +34,9 @@ module Decidim
34
34
  attr_reader :comment
35
35
 
36
36
  def set_comment
37
- @comment = Decidim::Comments::Comment.find_by(id: params[:comment_id])
37
+ @comment = Decidim::Comments::Comment
38
+ .for_organization(organization: current_organization)
39
+ .find(params.require(:comment_id))
38
40
  end
39
41
  end
40
42
  end
@@ -59,6 +59,14 @@ module Decidim
59
59
 
60
60
  scope :not_deleted, -> { where(deleted_at: nil) }
61
61
 
62
+ # Scopes comments to the participatory spaces owned by the organization.
63
+ # Comments on resources store their participatory space, while comments
64
+ # on participatory spaces use the space itself as the root commentable.
65
+ def self.for_organization(organization:)
66
+ spaces = organization.participatory_spaces
67
+ where(participatory_space: spaces).or(where(root_commentable: spaces))
68
+ end
69
+
62
70
  translatable_fields :body
63
71
  searchable_fields({
64
72
  participatory_space: :itself,
@@ -191,7 +191,7 @@ ca:
191
191
  email_intro: Has estat esmentada
192
192
  email_outro: Has rebut aquesta notificació perquè t'han esmentat al comentari "%{resource_title}".
193
193
  email_subject: Has estat esmentada a %{resource_title}
194
- notification_title: T'han esmentat per <a href="%{author_path}">%{author_name}</a> a <a href="%{resource_path}">%{resource_title}</a>
194
+ notification_title: <a href="%{author_path}">%{author_name}</a> t'ha esmentat a <a href="%{resource_path}">%{resource_title}</a>
195
195
  errors:
196
196
  messages:
197
197
  cannot_have_comments: no es poden fer comentaris
@@ -146,6 +146,7 @@ fr-CA:
146
146
  comment_votes:
147
147
  id: L'id du vote
148
148
  comments:
149
+ author: Le nom du participant qui a laissé ce commentaire
149
150
  body: Le commentaire lui-même
150
151
  commentable_id: L'identifiant unique de l"élément commenté
151
152
  commentable_type: Le type de l'élément commenté (si c'était un résultat, une proposition, etc.)
@@ -182,10 +182,12 @@ sk:
182
182
  email_intro: "%{author_name} komentoval na %{resource_title}. Môžete si to prečítať na stránke:"
183
183
  email_outro: Túto notifikáciu ste dostali, pretože sledujete autora "%{author_name}". Notifikácie môžete zrušiť po kliknutí na predchádzajúci odkaz.
184
184
  email_subject: Je nový komentár od %{author_name} na %{resource_title}
185
+ notification_title: V <a href="%{resource_path}">%{resource_title}</a> je nový komentár od <a href="%{author_path}">%{author_name}</a>.
185
186
  comment_created:
186
187
  email_intro: "%{resource_title} bol okomentovaný. Komentár si môžete prečítať na stránke:"
187
188
  email_outro: Túto notifikáciu ste dostali, pretože sledujete "%{resource_title}" alebo autora. Notifikácie môžete zrušiť po kliknutí na predchádzajúci odkaz.
188
189
  email_subject: Je nový komentár od %{author_name} na %{resource_title}
190
+ notification_title: V <a href="%{resource_path}">%{resource_title}</a> je nový komentár od <a href="%{author_path}">%{author_name}</a>
189
191
  comment_downvoted:
190
192
  email_intro: Váš komentár v „%{resource_title}“ získal negatívny hlas. Teraz má celkovo %{upvotes} pozitívnych hlasov a %{downvotes} negatívnych hlasov.
191
193
  email_outro: Toto upozornenie ste dostali, pretože ste autorom tohto komentára.
@@ -200,10 +202,12 @@ sk:
200
202
  email_intro: "%{author_name} odpovedal na váš komentár na %{resource_title}. Môžete si to prečítať na stránke:"
201
203
  email_outro: Túto notifikáciu ste dostali, pretože niekto odpovedal na Váš komentár.
202
204
  email_subject: "%{author_name} odpovedal na Váš komentár na %{resource_title}"
205
+ notification_title: <a href="%{author_path}">%{author_name}</a> odpovedal/a na váš komentár v <a href="%{resource_path}">%{resource_title}</a>
203
206
  user_mentioned:
204
207
  email_intro: Niekto vás spomenul
205
208
  email_outro: Túto notifikáciu ste dostali, pretože ste boli spomenutí na %{resource_title}.
206
209
  email_subject: Boli ste spomenutí na %{resource_title}
210
+ notification_title: <a href="%{author_path}">%{author_name}</a> vás spomenul/a v <a href="%{resource_path}">%{resource_title}</a>
207
211
  errors:
208
212
  messages:
209
213
  cannot_have_comments: nemôže mať komentáre
@@ -50,10 +50,13 @@ module Decidim
50
50
  # @return [Decidim::Comments::Comment]
51
51
  def create_comment(resource, root_commentable = nil)
52
52
  author = random_user
53
+ root = root_commentable || resource
54
+ space = root.respond_to?(:participatory_space) ? root.participatory_space : root
53
55
 
54
56
  params = {
55
57
  commentable: resource,
56
- root_commentable: root_commentable || resource,
58
+ root_commentable: root,
59
+ participatory_space: space,
57
60
  body: { en: ::Faker::Lorem.sentence(word_count: 50) },
58
61
  author:
59
62
  }
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-comments version.
5
5
  module Comments
6
6
  def self.version
7
- "0.31.8"
7
+ "0.31.9"
8
8
  end
9
9
  end
10
10
  end
@@ -18,6 +18,7 @@ module Decidim
18
18
  autoload :CommentVoteSerializer, "decidim/comments/comment_vote_serializer"
19
19
  autoload :Export, "decidim/comments/export"
20
20
  autoload :Markdown, "decidim/comments/markdown"
21
+ autoload :Seed, "decidim/comments/seed"
21
22
 
22
23
  def self.data_portable_entities
23
24
  ["Decidim::Comments::Comment", "Decidim::Comments::CommentVote"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.8
4
+ version: 0.31.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2026-10-22 00:00:00.000000000 Z
13
+ date: 2026-11-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.31.8
21
+ version: 0.31.9
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.31.8
28
+ version: 0.31.9
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: redcarpet
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -52,28 +52,28 @@ dependencies:
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 0.31.8
55
+ version: 0.31.9
56
56
  type: :development
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 0.31.8
62
+ version: 0.31.9
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: decidim-dev
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 0.31.8
69
+ version: 0.31.9
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 0.31.8
76
+ version: 0.31.9
77
77
  description: Pluggable comments system for some components.
78
78
  email:
79
79
  - josepjaume@gmail.com
@@ -139,7 +139,6 @@ files:
139
139
  - app/models/decidim/comments/application_record.rb
140
140
  - app/models/decidim/comments/comment.rb
141
141
  - app/models/decidim/comments/comment_vote.rb
142
- - app/models/decidim/comments/seed.rb
143
142
  - app/packs/entrypoints/decidim_comments.js
144
143
  - app/packs/src/decidim/comments/comments.component.js
145
144
  - app/packs/src/decidim/comments/comments.component.test.js
@@ -295,6 +294,7 @@ files:
295
294
  - lib/decidim/comments/markdown.rb
296
295
  - lib/decidim/comments/mutation_extensions.rb
297
296
  - lib/decidim/comments/query_extensions.rb
297
+ - lib/decidim/comments/seed.rb
298
298
  - lib/decidim/comments/test.rb
299
299
  - lib/decidim/comments/test/factories.rb
300
300
  - lib/decidim/comments/test/shared_examples/comment_event.rb