decidim-comments 0.27.9 → 0.28.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/comments/comment/actions.erb +13 -7
  3. data/app/cells/decidim/comments/comment/alignment_badge.erb +1 -4
  4. data/app/cells/decidim/comments/comment/deletion_data.erb +9 -1
  5. data/app/cells/decidim/comments/comment/moderation_data.erb +1 -1
  6. data/app/cells/decidim/comments/comment/replies.erb +3 -0
  7. data/app/cells/decidim/comments/comment/show.erb +72 -35
  8. data/app/cells/decidim/comments/comment/votes.erb +14 -14
  9. data/app/cells/decidim/comments/comment_activity_cell.rb +11 -7
  10. data/app/cells/decidim/comments/comment_card_cell.rb +2 -2
  11. data/app/cells/decidim/comments/comment_cell.rb +9 -21
  12. data/app/cells/decidim/comments/comment_form/comment_as.erb +3 -3
  13. data/app/cells/decidim/comments/comment_form/opinion.erb +18 -0
  14. data/app/cells/decidim/comments/comment_form/show.erb +33 -16
  15. data/app/cells/decidim/comments/comment_form_cell.rb +9 -1
  16. data/app/cells/decidim/comments/comment_metadata_cell.rb +27 -0
  17. data/app/cells/decidim/comments/comment_s_cell.rb +27 -0
  18. data/app/cells/decidim/comments/comment_thread/show.erb +2 -5
  19. data/app/cells/decidim/comments/comment_thread_cell.rb +0 -6
  20. data/app/cells/decidim/comments/comments/add_comment.erb +1 -20
  21. data/app/cells/decidim/comments/comments/blocked_comments_warning.erb +1 -3
  22. data/app/cells/decidim/comments/comments/comments_loading.erb +1 -3
  23. data/app/cells/decidim/comments/comments/order_control.erb +11 -35
  24. data/app/cells/decidim/comments/comments/show.erb +8 -9
  25. data/app/cells/decidim/comments/comments/single_comment_warning.erb +6 -9
  26. data/app/cells/decidim/comments/comments/user_comments_blocked_warning.erb +9 -6
  27. data/app/cells/decidim/comments/comments_cell.rb +1 -1
  28. data/app/cells/decidim/comments/edit_comment_modal_form/show.erb +20 -15
  29. data/app/commands/decidim/comments/create_comment.rb +17 -5
  30. data/app/commands/decidim/comments/delete_comment.rb +1 -1
  31. data/app/commands/decidim/comments/update_comment.rb +14 -2
  32. data/app/commands/decidim/comments/vote_comment.rb +1 -1
  33. data/app/controllers/decidim/comments/comments_controller.rb +14 -9
  34. data/app/controllers/decidim/comments/votes_controller.rb +1 -1
  35. data/app/events/decidim/comments/comment_by_followed_user_event.rb +1 -1
  36. data/app/events/decidim/comments/comment_by_followed_user_group_event.rb +1 -1
  37. data/app/events/decidim/comments/comment_event.rb +2 -7
  38. data/app/events/decidim/comments/reply_created_event.rb +1 -1
  39. data/app/events/decidim/comments/user_group_mentioned_event.rb +1 -1
  40. data/app/events/decidim/comments/user_mentioned_event.rb +1 -1
  41. data/app/helpers/decidim/comments/comment_cells_helper.rb +1 -1
  42. data/app/jobs/decidim/comments/hide_all_created_by_author_job.rb +13 -0
  43. data/app/models/decidim/comments/comment.rb +9 -7
  44. data/app/models/decidim/comments/comment_vote.rb +0 -10
  45. data/app/models/decidim/comments/seed.rb +30 -14
  46. data/app/packs/entrypoints/decidim_comments.js +5 -0
  47. data/app/packs/src/decidim/comments/comments.component.js +27 -36
  48. data/app/packs/src/decidim/comments/comments.component.test.js +218 -240
  49. data/app/packs/src/decidim/comments/comments.component_for_testing.js +1 -1
  50. data/app/packs/src/decidim/comments/comments.js +20 -1
  51. data/app/packs/stylesheets/comments.scss +327 -0
  52. data/app/queries/decidim/comments/metrics/comments_metric_manage.rb +1 -1
  53. data/app/queries/decidim/comments/sorted_comments.rb +10 -10
  54. data/app/services/decidim/comments/comment_creation.rb +1 -1
  55. data/app/services/decidim/comments/new_comment_notification_creator.rb +8 -8
  56. data/app/views/decidim/comments/admin/shared/_availability_fields.html.erb +4 -9
  57. data/app/views/decidim/comments/comments/_comment.html.erb +1 -1
  58. data/app/views/decidim/comments/comments/_comments.html.erb +1 -1
  59. data/app/views/decidim/comments/comments/_delete.html.erb +2 -4
  60. data/app/views/decidim/comments/comments/_moderated.html.erb +2 -4
  61. data/app/views/decidim/comments/comments/create.js.erb +5 -3
  62. data/app/views/decidim/comments/comments/delete.js.erb +4 -1
  63. data/app/views/decidim/comments/comments/index.js.erb +8 -1
  64. data/app/views/decidim/comments/comments/reload.js.erb +1 -2
  65. data/app/views/decidim/comments/comments/update.js.erb +5 -4
  66. data/app/views/decidim/comments/votes/create.js.erb +5 -5
  67. data/config/assets.rb +3 -0
  68. data/config/locales/ar.yml +0 -16
  69. data/config/locales/bg.yml +0 -166
  70. data/config/locales/ca.yml +15 -17
  71. data/config/locales/cs.yml +8 -10
  72. data/config/locales/de.yml +7 -9
  73. data/config/locales/el.yml +3 -11
  74. data/config/locales/en.yml +10 -12
  75. data/config/locales/es-MX.yml +10 -12
  76. data/config/locales/es-PY.yml +10 -12
  77. data/config/locales/es.yml +16 -18
  78. data/config/locales/eu.yml +6 -8
  79. data/config/locales/fi-plain.yml +7 -9
  80. data/config/locales/fi.yml +11 -13
  81. data/config/locales/fr-CA.yml +9 -11
  82. data/config/locales/fr.yml +9 -11
  83. data/config/locales/ga-IE.yml +0 -4
  84. data/config/locales/gl.yml +0 -16
  85. data/config/locales/hu.yml +3 -11
  86. data/config/locales/id-ID.yml +0 -11
  87. data/config/locales/is-IS.yml +0 -8
  88. data/config/locales/it.yml +0 -16
  89. data/config/locales/ja.yml +6 -8
  90. data/config/locales/lb.yml +0 -16
  91. data/config/locales/lt.yml +7 -10
  92. data/config/locales/lv.yml +0 -11
  93. data/config/locales/nl.yml +0 -16
  94. data/config/locales/no.yml +0 -16
  95. data/config/locales/pl.yml +7 -11
  96. data/config/locales/pt-BR.yml +0 -18
  97. data/config/locales/pt.yml +0 -16
  98. data/config/locales/ro-RO.yml +6 -14
  99. data/config/locales/ru.yml +0 -11
  100. data/config/locales/sk.yml +0 -11
  101. data/config/locales/sq-AL.yml +0 -38
  102. data/config/locales/sv.yml +4 -18
  103. data/config/locales/tr-TR.yml +1 -13
  104. data/config/locales/uk.yml +0 -8
  105. data/config/locales/zh-CN.yml +0 -13
  106. data/config/locales/zh-TW.yml +1 -9
  107. data/lib/decidim/api/comment_type.rb +2 -2
  108. data/lib/decidim/api/commentable_interface.rb +1 -1
  109. data/lib/decidim/comments/comment_serializer.rb +1 -1
  110. data/lib/decidim/comments/comment_vote_serializer.rb +1 -1
  111. data/lib/decidim/comments/commentable.rb +1 -1
  112. data/lib/decidim/comments/comments_helper.rb +6 -3
  113. data/lib/decidim/comments/engine.rb +31 -1
  114. data/lib/decidim/comments/export.rb +1 -1
  115. data/lib/decidim/comments/test/factories.rb +9 -22
  116. data/lib/decidim/comments/test/shared_examples/comment_event.rb +4 -37
  117. data/lib/decidim/comments/test/shared_examples/comment_voted_event.rb +4 -4
  118. data/lib/decidim/comments/test/shared_examples/create_comment_context.rb +5 -5
  119. data/lib/decidim/comments/test/shared_examples/has_comments_availability_attributes.rb +2 -2
  120. data/lib/decidim/comments/test/shared_examples/translatable_comment.rb +3 -3
  121. data/lib/decidim/comments/version.rb +1 -1
  122. metadata +27 -24
  123. data/app/cells/decidim/comments/comment/author.erb +0 -1
  124. data/app/cells/decidim/comments/comment/utilities.erb +0 -41
  125. data/app/cells/decidim/comments/comment_m/footer.erb +0 -5
  126. data/app/cells/decidim/comments/comment_m/top.erb +0 -7
  127. data/app/cells/decidim/comments/comment_m_cell.rb +0 -29
  128. data/app/cells/decidim/comments/comment_thread/title.erb +0 -3
  129. data/config/locales/he-IL.yml +0 -1
  130. data/db/migrate/20240304092558_add_comment_vote_counter_cache_to_comments.rb +0 -21
  131. data/decidim-comments.gemspec +0 -33
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- shared_context "when it's a comment event" do
5
+ shared_context "when it is a comment event" do
6
6
  include Decidim::ComponentPathHelper
7
7
  include Decidim::SanitizeHelper
8
8
 
@@ -16,10 +16,10 @@ shared_context "when it's 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_sanitize_translated(resource.title) }
19
+ let(:resource_title) { decidim_html_escape(translated(resource.title)) }
20
20
  let(:user_group) do
21
- user_group = create(:user_group, :verified, organization: organization, users: [comment_author])
22
- comment.update!(user_group: user_group)
21
+ user_group = create(:user_group, :verified, organization:, users: [comment_author])
22
+ comment.update!(user_group:)
23
23
  user_group
24
24
  end
25
25
  end
@@ -42,37 +42,4 @@ 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
78
45
  end
@@ -3,16 +3,16 @@
3
3
  require "spec_helper"
4
4
 
5
5
  shared_examples_for "a comment voted event" do
6
- include_context "when it's a comment event"
6
+ include_context "when it is a comment event"
7
7
 
8
8
  let(:resource) { comment.commentable }
9
9
 
10
10
  let(:comment) { create :comment }
11
- let(:comment_vote) { create :comment_vote, comment: comment }
11
+ let(:comment_vote) { create :comment_vote, comment: }
12
12
  let(:comment_vote_author) { comment_vote.author }
13
13
 
14
- let(:extra) { { comment_id: comment.id, author_id: comment_vote_author.id, weight: weight, downvotes: 100, upvotes: 999 } }
15
- let(:resource_title) { decidim_sanitize_translated(resource.title) }
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)) }
16
16
  let(:resource_text) { subject.resource_text }
17
17
 
18
18
  let(:verb) { weight.positive? ? "upvoted" : "downvoted" }
@@ -2,13 +2,13 @@
2
2
 
3
3
  RSpec.shared_context "when creating a comment" do
4
4
  let(:organization) { create(:organization) }
5
- let(:participatory_process) { create(:participatory_process, organization: organization) }
5
+ let(:participatory_process) { create(:participatory_process, organization:) }
6
6
  let(:component) { create(:component, participatory_space: participatory_process) }
7
- let(:user) { create(:user, organization: organization) }
8
- let(:author) { create(:user, organization: organization) }
9
- let(:dummy_resource) { create :dummy_resource, component: component }
7
+ let(:user) { create(:user, organization:) }
8
+ let(:author) { create(:user, organization:) }
9
+ let(:dummy_resource) { create :dummy_resource, component: }
10
10
  let(:commentable) { dummy_resource }
11
- let(:body) { ::Faker::Lorem.paragraph }
11
+ let(:body) { Faker::Lorem.paragraph }
12
12
  let(:alignment) { 1 }
13
13
  let(:user_group_id) { nil }
14
14
  let(:form_params) do
@@ -5,11 +5,11 @@ shared_examples_for "has comments availability attributes" do
5
5
  let(:comments_start_time) { nil }
6
6
  let(:comments_end_time) { nil }
7
7
  let(:updates) do
8
- { comments_enabled: comments_enabled }.merge(
8
+ { comments_enabled: }.merge(
9
9
  if subject.is_a?(Decidim::Debates::Debate)
10
10
  { start_time: comments_start_time, end_time: comments_end_time }
11
11
  else
12
- { comments_start_time: comments_start_time, comments_end_time: comments_end_time }
12
+ { comments_start_time:, comments_end_time: }
13
13
  end
14
14
  )
15
15
  end
@@ -6,10 +6,10 @@ shared_examples_for "a translated comment event" do
6
6
  describe "translated notifications" do
7
7
  let(:en_body) { "This is Sparta!" }
8
8
  let(:body) { { en: en_body, machine_translations: { ca: "C'est Sparta!" } } }
9
- let(:participatory_process) { create :participatory_process, organization: organization }
9
+ let(:participatory_process) { create :participatory_process, organization: }
10
10
  let(:component) { create(:component, participatory_space: participatory_process) }
11
- let(:commentable) { create(:dummy_resource, component: component) }
12
- let(:comment) { create :comment, body: body, commentable: commentable }
11
+ let(:commentable) { create(:dummy_resource, component:) }
12
+ let(:comment) { create :comment, body:, commentable: }
13
13
  let(:en_version) { "<div><p>#{comment.body["en"]}</p></div>" }
14
14
  let(:machine_translated) { "<div><p>#{comment.body["machine_translations"]["ca"]}</p></div>" }
15
15
 
@@ -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.27.9"
7
+ "0.28.0.rc4"
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.27.9
4
+ version: 0.28.0.rc4
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: 2024-09-10 00:00:00.000000000 Z
13
+ date: 2023-12-11 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.27.9
21
+ version: 0.28.0.rc4
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.27.9
28
+ version: 0.28.0.rc4
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.27.9
55
+ version: 0.28.0.rc4
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.27.9
62
+ version: 0.28.0.rc4
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.27.9
69
+ version: 0.28.0.rc4
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.27.9
76
+ version: 0.28.0.rc4
77
77
  description: Pluggable comments system for some components.
78
78
  email:
79
79
  - josepjaume@gmail.com
@@ -87,23 +87,21 @@ files:
87
87
  - Rakefile
88
88
  - app/cells/decidim/comments/comment/actions.erb
89
89
  - app/cells/decidim/comments/comment/alignment_badge.erb
90
- - app/cells/decidim/comments/comment/author.erb
91
90
  - app/cells/decidim/comments/comment/deletion_data.erb
92
91
  - app/cells/decidim/comments/comment/moderation_data.erb
92
+ - app/cells/decidim/comments/comment/replies.erb
93
93
  - app/cells/decidim/comments/comment/show.erb
94
- - app/cells/decidim/comments/comment/utilities.erb
95
94
  - app/cells/decidim/comments/comment/votes.erb
96
95
  - app/cells/decidim/comments/comment_activity_cell.rb
97
96
  - app/cells/decidim/comments/comment_card_cell.rb
98
97
  - app/cells/decidim/comments/comment_cell.rb
99
98
  - app/cells/decidim/comments/comment_form/comment_as.erb
99
+ - app/cells/decidim/comments/comment_form/opinion.erb
100
100
  - app/cells/decidim/comments/comment_form/show.erb
101
101
  - app/cells/decidim/comments/comment_form_cell.rb
102
- - app/cells/decidim/comments/comment_m/footer.erb
103
- - app/cells/decidim/comments/comment_m/top.erb
104
- - app/cells/decidim/comments/comment_m_cell.rb
102
+ - app/cells/decidim/comments/comment_metadata_cell.rb
103
+ - app/cells/decidim/comments/comment_s_cell.rb
105
104
  - app/cells/decidim/comments/comment_thread/show.erb
106
- - app/cells/decidim/comments/comment_thread/title.erb
107
105
  - app/cells/decidim/comments/comment_thread_cell.rb
108
106
  - app/cells/decidim/comments/comments/add_comment.erb
109
107
  - app/cells/decidim/comments/comments/blocked_comments_warning.erb
@@ -134,14 +132,17 @@ files:
134
132
  - app/events/decidim/comments/user_mentioned_event.rb
135
133
  - app/forms/decidim/comments/comment_form.rb
136
134
  - app/helpers/decidim/comments/comment_cells_helper.rb
135
+ - app/jobs/decidim/comments/hide_all_created_by_author_job.rb
137
136
  - app/models/decidim/comments/application_record.rb
138
137
  - app/models/decidim/comments/comment.rb
139
138
  - app/models/decidim/comments/comment_vote.rb
140
139
  - app/models/decidim/comments/seed.rb
140
+ - app/packs/entrypoints/decidim_comments.js
141
141
  - app/packs/src/decidim/comments/comments.component.js
142
142
  - app/packs/src/decidim/comments/comments.component.test.js
143
143
  - app/packs/src/decidim/comments/comments.component_for_testing.js
144
144
  - app/packs/src/decidim/comments/comments.js
145
+ - app/packs/stylesheets/comments.scss
145
146
  - app/permissions/decidim/comments/permissions.rb
146
147
  - app/queries/decidim/comments/metrics/comment_participants_metric_measure.rb
147
148
  - app/queries/decidim/comments/metrics/comments_metric_manage.rb
@@ -199,7 +200,6 @@ files:
199
200
  - config/locales/ga-IE.yml
200
201
  - config/locales/gl.yml
201
202
  - config/locales/gn-PY.yml
202
- - config/locales/he-IL.yml
203
203
  - config/locales/hr-HR.yml
204
204
  - config/locales/hr.yml
205
205
  - config/locales/hu.yml
@@ -263,9 +263,7 @@ files:
263
263
  - db/migrate/20200828101910_add_commentable_counter_cache_to_comments.rb
264
264
  - db/migrate/20210402124534_add_participatory_process_to_comments.rb
265
265
  - db/migrate/20210529095942_add_deleted_at_column_to_comments.rb
266
- - db/migrate/20240304092558_add_comment_vote_counter_cache_to_comments.rb
267
266
  - db/seeds.rb
268
- - decidim-comments.gemspec
269
267
  - lib/decidim/api/add_comment_type.rb
270
268
  - lib/decidim/api/comment_mutation_type.rb
271
269
  - lib/decidim/api/comment_type.rb
@@ -296,26 +294,31 @@ files:
296
294
  - lib/decidim/comments/test/shared_examples/translatable_comment.rb
297
295
  - lib/decidim/comments/version.rb
298
296
  - lib/tasks/decidim_comments.rake
299
- homepage: https://github.com/decidim/decidim
297
+ homepage: https://decidim.org
300
298
  licenses:
301
299
  - AGPL-3.0
302
- metadata: {}
300
+ metadata:
301
+ bug_tracker_uri: https://github.com/decidim/decidim/issues
302
+ documentation_uri: https://docs.decidim.org/
303
+ funding_uri: https://opencollective.com/decidim
304
+ homepage_uri: https://decidim.org
305
+ source_code_uri: https://github.com/decidim/decidim
303
306
  post_install_message:
304
307
  rdoc_options: []
305
308
  require_paths:
306
309
  - lib
307
310
  required_ruby_version: !ruby/object:Gem::Requirement
308
311
  requirements:
309
- - - "~>"
312
+ - - ">="
310
313
  - !ruby/object:Gem::Version
311
- version: 3.0.0
314
+ version: '3.1'
312
315
  required_rubygems_version: !ruby/object:Gem::Requirement
313
316
  requirements:
314
- - - ">="
317
+ - - ">"
315
318
  - !ruby/object:Gem::Version
316
- version: '0'
319
+ version: 1.3.1
317
320
  requirements: []
318
- rubygems_version: 3.5.14
321
+ rubygems_version: 3.4.20
319
322
  signing_key:
320
323
  specification_version: 4
321
324
  summary: Decidim comments module
@@ -1 +0,0 @@
1
- <%== cell("decidim/author", author_presenter).profile %>
@@ -1,41 +0,0 @@
1
- <div class="comment__header__context-menu">
2
- <label for="<%= context_menu_id %>" data-toggle="<%= context_menu_id %>">
3
- <%= icon "ellipses" %>
4
- </label>
5
- <ul id="<%= context_menu_id %>" data-dropdown data-close-on-click="true" data-position="left" data-alignment="top" class="card dropdown-pane comment__header__context-menu__content">
6
- <li>
7
- <button type="button" class="link-alt comment__header__context-menu__content-item" data-open="<%= current_user.present? ? "flagModalComment#{model.id}" : "loginModal" %>" title="<%= t("decidim.components.comment.report.title") %>" aria-controls="<%= current_user.present? ? "flagModalComment#{model.id}" : "loginModal" %>" aria-haspopup="dialog" tabindex="0">
8
- <%= icon "flag", class: "icon--small", aria_label: t("decidim.components.comment.report.title") %>
9
- <span><%= t("decidim.components.comment.report.action") %></span>
10
- </button>
11
- </li>
12
- <li>
13
- <%= link_to "#{commentable_path("commentId" => model.id)}#comment_#{model.id}", target: "_blank", class: "comment__header__context-menu__content-item", title: t("decidim.components.comment.single_comment_link_title") do %>
14
- <%= icon "link-intact", class: "icon--small", aria_label: t("decidim.components.comment.single_comment_link_title") %>
15
- <span><%= t("decidim.components.comment.single_comment_link_title") %></span>
16
- <% end %>
17
- </li>
18
- <% if model.authored_by?(current_user) %>
19
- <li>
20
- <button type="button" class="link-alt comment__header__context-menu__content-item" data-open="<%= "editCommentModal#{model.id}" %>" title="<%= t("decidim.components.comment.edit") %>" aria-controls="<%= "editCommentModal#{model.id}" %>" aria-haspopup="dialog" tabindex="0">
21
- <%= icon "pencil", class: "icon--small", aria_label: t("decidim.components.comment.edit") %>
22
- <span><%= t("decidim.components.comment.edit") %></span>
23
- </button>
24
- </li>
25
- <li>
26
- <%= link_to comment_path, remote: true, method: :delete, class: "comment__header__context-menu__content-item", data: { confirm: t("decidim.components.comment.confirm_destroy") } do %>
27
- <%= icon "trash", class: "icon--small", aria_label: t("decidim.components.comment.delete") %>
28
- <span><%= t("decidim.components.comment.delete") %></span>
29
- <% end %>
30
- </li>
31
- <% end %>
32
- </ul>
33
- </div>
34
- <% unless reloaded? %>
35
- <% if current_user.present? %>
36
- <%= cell("decidim/flag_modal", model, modal_id: "flagModalComment#{model.id}") %>
37
- <% end %>
38
- <% if model.authored_by?(current_user) %>
39
- <%= cell("decidim/comments/edit_comment_modal_form", model, modal_id: "editCommentModal#{model.id}") %>
40
- <% end %>
41
- <% end %>
@@ -1,5 +0,0 @@
1
- <div class="card__footer">
2
- <div class="card__support">
3
- <%= link_to t("view", scope: "decidim.comments"), resource_link_path, class: "card__button button button--sc small" %>
4
- </div>
5
- </div>
@@ -1,7 +0,0 @@
1
- <div class="card__top">
2
- <% if render_space? %>
3
- <div class="card__content text-small">
4
- <span class="muted"><%= searchable_resource_human_name(model.root_commentable.class, count: 1) %>:</span>&nbsp;<%= link_to root_commentable_title, resource_link_path, class: "card__link text-ellipsis" %>
5
- </div>
6
- <% end %>
7
- </div>
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Comments
5
- # This cell renders the Medium (:m) comment card
6
- # for an given instance of a Comment
7
- class CommentMCell < Decidim::CardMCell
8
- include CommentCellsHelper
9
-
10
- def statuses
11
- []
12
- end
13
-
14
- def comment
15
- model
16
- end
17
-
18
- def has_header?
19
- false
20
- end
21
-
22
- delegate :participatory_space, to: :model
23
-
24
- def description
25
- strip_tags(model.formatted_body).truncate(200, separator: /\s/)
26
- end
27
- end
28
- end
29
- end
@@ -1,3 +0,0 @@
1
- <h6 class="comment-thread__title">
2
- <%= t("decidim.components.comment_thread.title", authorName: author_name) %>
3
- </h6>
@@ -1 +0,0 @@
1
- he:
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddCommentVoteCounterCacheToComments < ActiveRecord::Migration[6.1]
4
- def change
5
- add_column :decidim_comments_comments, :up_votes_count, :integer, null: false, default: 0, index: true
6
- add_column :decidim_comments_comments, :down_votes_count, :integer, null: false, default: 0, index: true
7
-
8
- # We cannot use the reset_counters as up_votes and down_votes are scoped associationws
9
- reversible do |dir|
10
- dir.up do
11
- Decidim::Comments::Comment.reset_column_information
12
- Decidim::Comments::Comment.find_each do |record|
13
- # rubocop:disable Rails/SkipsModelValidations
14
- record.class.update_counters(record.id, up_votes_count: record.up_votes.length)
15
- record.class.update_counters(record.id, down_votes_count: record.down_votes.length)
16
- # rubocop:enable Rails/SkipsModelValidations
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $LOAD_PATH.push File.expand_path("lib", __dir__)
4
-
5
- # Maintain your gem's version:
6
- require "decidim/comments/version"
7
-
8
- # Describe your gem and declare its dependencies:
9
- Gem::Specification.new do |s|
10
- s.version = Decidim::Comments.version
11
- s.authors = ["Josep Jaume Rey Peroy", "Marc Riera Casals", "Oriol Gual Oliva"]
12
- s.email = ["josepjaume@gmail.com", "mrc2407@gmail.com", "oriolgual@gmail.com"]
13
- s.license = "AGPL-3.0"
14
- s.homepage = "https://github.com/decidim/decidim"
15
- s.required_ruby_version = "~> 3.0.0"
16
-
17
- s.name = "decidim-comments"
18
- s.summary = "Decidim comments module"
19
- s.description = "Pluggable comments system for some components."
20
-
21
- s.files = Dir.chdir(__dir__) do
22
- `git ls-files -z`.split("\x0").select do |f|
23
- (File.expand_path(f) == __FILE__) ||
24
- f.start_with?(*%w(app/ config/ db/ lib/ Rakefile README.md))
25
- end
26
- end
27
-
28
- s.add_dependency "decidim-core", Decidim::Comments.version
29
- s.add_dependency "redcarpet", "~> 3.5", ">= 3.5.1"
30
-
31
- s.add_development_dependency "decidim-admin", Decidim::Comments.version
32
- s.add_development_dependency "decidim-dev", Decidim::Comments.version
33
- end