decidim-comments 0.28.0 → 0.28.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/comments/comment/actions.erb +4 -5
  3. data/app/cells/decidim/comments/comment/show.erb +7 -5
  4. data/app/cells/decidim/comments/comment_cell.rb +24 -4
  5. data/app/cells/decidim/comments/comment_thread/show.erb +1 -1
  6. data/app/cells/decidim/comments/comments/order_control.erb +2 -1
  7. data/app/cells/decidim/comments/comments/show.erb +1 -1
  8. data/app/cells/decidim/comments/comments/user_comments_blocked_warning.erb +2 -2
  9. data/app/cells/decidim/comments/comments_cell.rb +5 -1
  10. data/app/events/decidim/comments/comment_event.rb +4 -0
  11. data/app/models/decidim/comments/comment.rb +2 -2
  12. data/app/models/decidim/comments/comment_vote.rb +10 -0
  13. data/app/packs/src/decidim/comments/comments.component.test.js +4 -4
  14. data/app/packs/src/decidim/comments/comments.component_for_testing.js +1 -0
  15. data/config/locales/ar.yml +0 -1
  16. data/config/locales/bg.yml +169 -0
  17. data/config/locales/ca.yml +13 -8
  18. data/config/locales/cs.yml +3 -1
  19. data/config/locales/de.yml +6 -1
  20. data/config/locales/el.yml +0 -1
  21. data/config/locales/en.yml +6 -1
  22. data/config/locales/es-MX.yml +6 -1
  23. data/config/locales/es-PY.yml +6 -1
  24. data/config/locales/es.yml +14 -9
  25. data/config/locales/eu.yml +3 -1
  26. data/config/locales/fi-plain.yml +6 -1
  27. data/config/locales/fi.yml +6 -1
  28. data/config/locales/fr-CA.yml +6 -1
  29. data/config/locales/fr.yml +6 -1
  30. data/config/locales/gl.yml +0 -1
  31. data/config/locales/he-IL.yml +1 -0
  32. data/config/locales/hu.yml +5 -1
  33. data/config/locales/it.yml +0 -1
  34. data/config/locales/ja.yml +5 -1
  35. data/config/locales/lb.yml +0 -1
  36. data/config/locales/lt.yml +0 -1
  37. data/config/locales/lv.yml +0 -1
  38. data/config/locales/nl.yml +0 -1
  39. data/config/locales/no.yml +0 -1
  40. data/config/locales/pl.yml +5 -1
  41. data/config/locales/pt-BR.yml +0 -1
  42. data/config/locales/pt.yml +0 -1
  43. data/config/locales/ro-RO.yml +7 -4
  44. data/config/locales/sk.yml +0 -1
  45. data/config/locales/sq-AL.yml +41 -0
  46. data/config/locales/sr-CS.yml +0 -2
  47. data/config/locales/sv.yml +0 -1
  48. data/config/locales/tr-TR.yml +3 -1
  49. data/config/locales/zh-CN.yml +0 -1
  50. data/config/locales/zh-TW.yml +0 -1
  51. data/db/migrate/20240304092558_add_comment_vote_counter_cache_to_comments.rb +21 -0
  52. data/decidim-comments.gemspec +40 -0
  53. data/lib/decidim/api/comment_type.rb +2 -2
  54. data/lib/decidim/comments/test/factories.rb +20 -7
  55. data/lib/decidim/comments/test/shared_examples/comment_event.rb +34 -1
  56. data/lib/decidim/comments/test/shared_examples/comment_voted_event.rb +1 -1
  57. data/lib/decidim/comments/version.rb +1 -1
  58. metadata +14 -12
  59. data/config/environment.rb +0 -3
@@ -16,7 +16,7 @@ shared_context "when it is a comment event" do
16
16
  let(:comment_author_name) { decidim_html_escape comment.author.name }
17
17
 
18
18
  let(:extra) { { comment_id: comment.id } }
19
- let(:resource_title) { decidim_html_escape(translated(resource.title)) }
19
+ let(:resource_title) { decidim_sanitize_translated(resource.title) }
20
20
  let(:user_group) do
21
21
  user_group = create(:user_group, :verified, organization:, users: [comment_author])
22
22
  comment.update!(user_group:)
@@ -42,4 +42,37 @@ shared_examples_for "a comment event" do
42
42
  expect(subject.resource_text).to eq comment.formatted_body
43
43
  end
44
44
  end
45
+
46
+ describe "hidden_resource?" do
47
+ context "when comment is not moderated" do
48
+ it "returns false" do
49
+ expect(subject.hidden_resource?).to be false
50
+ end
51
+ end
52
+
53
+ context "when comment is moderated" do
54
+ let(:comment) { create(:comment, :moderated) }
55
+
56
+ it "returns true" do
57
+ expect(subject.hidden_resource?).to be true
58
+ end
59
+ end
60
+
61
+ context "when resource is not moderated" do
62
+ it "returns false" do
63
+ expect(subject.hidden_resource?).to be false
64
+ end
65
+ end
66
+
67
+ context "when resource is moderated" do
68
+ before do
69
+ create(:moderation, reportable: resource, hidden_at: 2.days.ago)
70
+ resource.reload
71
+ end
72
+
73
+ it "returns true" do
74
+ expect(subject.hidden_resource?).to be true
75
+ end
76
+ end
77
+ end
45
78
  end
@@ -12,7 +12,7 @@ shared_examples_for "a comment voted event" do
12
12
  let(:comment_vote_author) { comment_vote.author }
13
13
 
14
14
  let(:extra) { { comment_id: comment.id, author_id: comment_vote_author.id, weight:, downvotes: 100, upvotes: 999 } }
15
- let(:resource_title) { decidim_html_escape(translated(resource.title)) }
15
+ let(:resource_title) { decidim_sanitize_translated(resource.title) }
16
16
  let(:resource_text) { subject.resource_text }
17
17
 
18
18
  let(:verb) { weight.positive? ? "upvoted" : "downvoted" }
@@ -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.28.0"
7
+ "0.28.2"
8
8
  end
9
9
  end
10
10
  end
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.28.0
4
+ version: 0.28.2
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: 2023-12-20 00:00:00.000000000 Z
13
+ date: 2024-07-16 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.28.0
21
+ version: 0.28.2
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.28.0
28
+ version: 0.28.2
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.28.0
55
+ version: 0.28.2
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.28.0
62
+ version: 0.28.2
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.28.0
69
+ version: 0.28.2
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.28.0
76
+ version: 0.28.2
77
77
  description: Pluggable comments system for some components.
78
78
  email:
79
79
  - josepjaume@gmail.com
@@ -168,7 +168,6 @@ files:
168
168
  - app/views/decidim/comments/votes/create.js.erb
169
169
  - app/views/decidim/comments/votes/error.js.erb
170
170
  - config/assets.rb
171
- - config/environment.rb
172
171
  - config/locales/am-ET.yml
173
172
  - config/locales/ar-SA.yml
174
173
  - config/locales/ar.yml
@@ -201,6 +200,7 @@ files:
201
200
  - config/locales/ga-IE.yml
202
201
  - config/locales/gl.yml
203
202
  - config/locales/gn-PY.yml
203
+ - config/locales/he-IL.yml
204
204
  - config/locales/hr-HR.yml
205
205
  - config/locales/hr.yml
206
206
  - config/locales/hu.yml
@@ -264,7 +264,9 @@ files:
264
264
  - db/migrate/20200828101910_add_commentable_counter_cache_to_comments.rb
265
265
  - db/migrate/20210402124534_add_participatory_process_to_comments.rb
266
266
  - db/migrate/20210529095942_add_deleted_at_column_to_comments.rb
267
+ - db/migrate/20240304092558_add_comment_vote_counter_cache_to_comments.rb
267
268
  - db/seeds.rb
269
+ - decidim-comments.gemspec
268
270
  - lib/decidim/api/add_comment_type.rb
269
271
  - lib/decidim/api/comment_mutation_type.rb
270
272
  - lib/decidim/api/comment_type.rb
@@ -310,16 +312,16 @@ require_paths:
310
312
  - lib
311
313
  required_ruby_version: !ruby/object:Gem::Requirement
312
314
  requirements:
313
- - - ">="
315
+ - - "~>"
314
316
  - !ruby/object:Gem::Version
315
- version: '3.1'
317
+ version: 3.1.0
316
318
  required_rubygems_version: !ruby/object:Gem::Requirement
317
319
  requirements:
318
320
  - - ">="
319
321
  - !ruby/object:Gem::Version
320
322
  version: '0'
321
323
  requirements: []
322
- rubygems_version: 3.4.22
324
+ rubygems_version: 3.3.7
323
325
  signing_key:
324
326
  specification_version: 4
325
327
  summary: Decidim comments module
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Empty line for playing nice with tpope/vim-rails