decidim-comments 0.27.6 → 0.28.0.rc4

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.
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 -3
  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 -23
  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 +7 -9
  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 +2 -16
  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 -16
  116. data/lib/decidim/comments/test/shared_examples/comment_event.rb +4 -4
  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 +30 -27
  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
@@ -20,22 +20,16 @@ tr:
20
20
  comments:
21
21
  create:
22
22
  error: Yorum oluşturulurken bir sorunla karşılaşıldı.
23
- comments_count: Yorum sayısı
24
- comments_title: Yorumlar
25
- last_activity:
26
- new_comment_at_html: "<span> %{link}</span> yeni yorum"
27
- view: Görünüm
28
23
  votes:
29
24
  create:
30
25
  error: Yorum oylanırken bir sorun oluştu.
31
26
  components:
32
27
  add_comment_form:
33
- account_message: Yorumunuzu eklemek için <a href="%{sign_in_url}"> hesabınızla oturum açın </a> veya <a href="%{sign_up_url}"> kaydolun </a>.
28
+ account_message: <a href="%{sign_in_url}">Hesabınızla giriş yapın</a> veya yorumunuzu eklemek için <a href="%{sign_up_url}">kaydolun</a>.
34
29
  form:
35
30
  body:
36
31
  label: Yorum
37
32
  placeholder: Bunun hakkında ne düşünüyorsun?
38
- form_error: Metin zorunludur ve %{length} karakterden uzun olamaz.
39
33
  user_group_id:
40
34
  label: Olarak yorum yap
41
35
  opinion:
@@ -57,7 +51,6 @@ tr:
57
51
  description: Bu içerik uygunsuz mu?
58
52
  details: Ek Yorumlar
59
53
  reasons:
60
- does_not_belong: Yasadışı faaliyet, intihar tehditleri, kişisel bilgiler veya %{organization_name} kuruluşuna ait olmadığını düşündüğünüz başka bir şey içeriyor.
61
54
  offensive: Irkçılık, cinsiyetçilik, hakaretler, kişisel saldırılar, ölüm tehditleri, intihar talepleri veya herhangi bir nefret söylemi içerir.
62
55
  spam: Clickbait, reklam, dolandırıcılık veya script botları içerir.
63
56
  title: Uygunsuz içerik bildir
@@ -68,8 +61,6 @@ tr:
68
61
  older: Daha eski
69
62
  recent: Son
70
63
  title: 'Tarafından sipariş:'
71
- comment_thread:
72
- title: '%{authorName}ile sohbet'
73
64
  comments:
74
65
  blocked_comments_for_user_warning: Şu anda yorum yapamıyorsunuz, ancak öncekileri okuyabilirsiniz.
75
66
  blocked_comments_warning: Yorumlar şu anda devre dışı, ancak öncekileri okuyabilirsiniz.
@@ -120,6 +111,3 @@ tr:
120
111
  description: Katılımcılar tarafından oluşturulan yorum sayısı
121
112
  object: yorumlar
122
113
  title: Yorumlar
123
- errors:
124
- messages:
125
- cannot_have_comments: yorum alamaz
@@ -26,12 +26,10 @@ uk:
26
26
  error: При голосуванні щодо коментаря сталися помилки.
27
27
  components:
28
28
  add_comment_form:
29
- account_message: <a href="%{sign_in_url}">Увійдіть за допомогою свого облікового запису</a> або <a href="%{sign_up_url}">зареєструйтесь</a>, щоб додати свій коментар.
30
29
  form:
31
30
  body:
32
31
  label: Коментар
33
32
  placeholder: Що ви думаєте з цього приводу?
34
- form_error: Тут обов'язково потрібно ввести текст, але не більше, ніж %{length} символів.
35
33
  user_group_id:
36
34
  label: Коментувати як
37
35
  opinion:
@@ -52,7 +50,6 @@ uk:
52
50
  description: Чи цей вміст неприпустимий?
53
51
  details: Додаткові коментарі
54
52
  reasons:
55
- does_not_belong: Містить незаконну діяльність, загрози самогубства, особисті відомості чи ще щось, неприпустиме, на вашу думку, для %{organization_name}.
56
53
  offensive: Містить расизм, сексизм, образи, особисті напади, погрози вбивства, заяви про самогубство або будь-які ненависницькі висловлювання.
57
54
  spam: Містить клацоловки (маніпулятивно-сенсаційні заголовки), рекламу, афери або лохотрони.
58
55
  comment_order_selector:
@@ -62,8 +59,6 @@ uk:
62
59
  older: Давніші
63
60
  recent: Нещодавнє
64
61
  title: 'Впорядкувати за:'
65
- comment_thread:
66
- title: Бесіда з %{authorName}
67
62
  comments:
68
63
  blocked_comments_warning: Коментарі зараз вимкнені, але ви можете прочитати попередні.
69
64
  loading: Завантаження коментарів...
@@ -92,6 +87,3 @@ uk:
92
87
  email_outro: Ви отримали це сповіщення, оскільки вас згадали в %{resource_title}.
93
88
  email_subject: Вас згадали у %{resource_title}
94
89
  notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> згадав вас у <a href="%{resource_path}">%{resource_title}</a>
95
- errors:
96
- messages:
97
- cannot_have_comments: не підлягає коментуванню
@@ -15,22 +15,15 @@ zh-CN:
15
15
  other: 所得票数
16
16
  decidim:
17
17
  comments:
18
- comments_count: 评论计数
19
- comments_title: 评论
20
- last_activity:
21
- new_comment_at_html: "<span>在 %{link}的新评论</span>"
22
- view: 查看
23
18
  votes:
24
19
  create:
25
20
  error: 在表决该评论时出现问题。
26
21
  components:
27
22
  add_comment_form:
28
- account_message: <a href="%{sign_in_url}">使用您的帐户</a> 或 <a href="%{sign_up_url}">注册</a> 来添加您的评论。
29
23
  form:
30
24
  body:
31
25
  label: 评论
32
26
  placeholder: 你对此有什么看法?
33
- form_error: 文本是必需的,不能超过 %{length} 个字符。
34
27
  user_group_id:
35
28
  label: 评论为
36
29
  opinion:
@@ -52,7 +45,6 @@ zh-CN:
52
45
  description: 这个内容是否不适当?
53
46
  details: 其他评论
54
47
  reasons:
55
- does_not_belong: 包含非法活动、自杀威胁、个人信息或你认为不属于 %{organization_name} 的其他东西。
56
48
  offensive: 包括种族主义、性别主义、污泥、个人攻击、死亡威胁、自杀请求或任何形式的仇恨言论。
57
49
  spam: 包含点击、广告、骗子或脚本机器人。
58
50
  title: 报告不恰当的内容
@@ -63,8 +55,6 @@ zh-CN:
63
55
  older: 更旧的
64
56
  recent: 最近的
65
57
  title: '排序方式:'
66
- comment_thread:
67
- title: 与 %{authorName} 的对话
68
58
  comments:
69
59
  blocked_comments_for_user_warning: 您此时无法评论,但您可以阅读前面的评论。
70
60
  blocked_comments_warning: 评论此时被禁用,但您可以阅读前面的评论。
@@ -112,6 +102,3 @@ zh-CN:
112
102
  description: 与会者生成的评论数
113
103
  object: 评论
114
104
  title: 评论
115
- errors:
116
- messages:
117
- cannot_have_comments: 不能有评论
@@ -29,23 +29,17 @@ zh-TW:
29
29
  error: 該評論無法被刪除。
30
30
  update:
31
31
  error: 更新評論時出現問題。
32
- comments_count: 評論次數
33
32
  comments_title: 評論
34
- last_activity:
35
- new_comment_at_html: "<span>在 %{link} 上發布了新評論</span>"
36
- view: 檢視
37
33
  votes:
38
34
  create:
39
35
  error: 投票評論時發生問題。
40
36
  components:
41
37
  add_comment_form:
42
- account_message: <a href="%{sign_in_url}">登入您的帳戶</a>或<a href="%{sign_up_url}">註冊</a>以新增您的評論。
43
38
  form:
44
39
  body:
45
40
  label: 評論
46
41
  placeholder: 你有什麼想法?
47
42
  form_error: 文字為必填欄位,且不可超過 %{length} 個字元。
48
- submit: 發送
49
43
  user_group_id:
50
44
  label: 評論者:
51
45
  opinion:
@@ -93,8 +87,6 @@ zh-TW:
93
87
  older: 較早的
94
88
  recent: 最近
95
89
  title: '排序方式:'
96
- comment_thread:
97
- title: 與 %{authorName} 的對話
98
90
  comments:
99
91
  blocked_comments_for_unauthorized_user_warning: 目前需要驗證您的身份才能發表評論,但您可以閱讀先前的評論。
100
92
  blocked_comments_for_user_warning: 目前您無法發表評論,但您可以閱讀先前的評論。
@@ -166,4 +158,4 @@ zh-TW:
166
158
  title: 評論
167
159
  errors:
168
160
  messages:
169
- cannot_have_comments: 無法留言
161
+ cannot_have_comments: 無法評論
@@ -58,7 +58,7 @@ module Decidim
58
58
  end
59
59
 
60
60
  def up_votes
61
- object.up_votes_count
61
+ object.up_votes.size
62
62
  end
63
63
 
64
64
  def up_voted
@@ -66,7 +66,7 @@ module Decidim
66
66
  end
67
67
 
68
68
  def down_votes
69
- object.down_votes_count
69
+ object.down_votes.size
70
70
  end
71
71
 
72
72
  def down_voted
@@ -25,7 +25,7 @@ module Decidim
25
25
  field :total_comments_count, GraphQL::Types::Int, description: "The number of comments in all levels this resource holds", null: false
26
26
 
27
27
  def comments(order_by: nil, single_comment_id: nil)
28
- SortedComments.for(object, order_by: order_by, id: single_comment_id).not_hidden
28
+ SortedComments.for(object, order_by:, id: single_comment_id).not_hidden
29
29
  end
30
30
 
31
31
  def total_comments_count
@@ -25,7 +25,7 @@ module Decidim
25
25
  },
26
26
  commentable_id: resource.decidim_commentable_id,
27
27
  commentable_type: resource.decidim_commentable_type,
28
- root_commentable_url: root_commentable_url
28
+ root_commentable_url:
29
29
  }
30
30
  end
31
31
 
@@ -26,7 +26,7 @@ module Decidim
26
26
  },
27
27
  commentable_id: resource.comment.decidim_commentable_id,
28
28
  commentable_type: resource.comment.decidim_commentable_type,
29
- root_commentable_url: root_commentable_url
29
+ root_commentable_url:
30
30
 
31
31
  },
32
32
  created_at: resource.created_at,
@@ -64,7 +64,7 @@ module Decidim
64
64
  # rubocop:disable Rails/SkipsModelValidations
65
65
  def update_comments_count
66
66
  comments_count = comments.not_hidden.not_deleted.count
67
- update_columns(comments_count: comments_count, updated_at: Time.current)
67
+ update_columns(comments_count:, updated_at: Time.current)
68
68
  end
69
69
  # rubocop:enable Rails/SkipsModelValidations
70
70
  end
@@ -10,9 +10,12 @@ module Decidim
10
10
  def comments_for(resource, options = {})
11
11
  return unless resource.commentable?
12
12
 
13
- content_for :expanded do
14
- inline_comments_for(resource, options)
15
- end
13
+ append_stylesheet_pack_tag "decidim_comments"
14
+ # This script cannot be deferred, otherwise the DOMReady and turbo:load listeners are not
15
+ # executed from a Turbo Frame call
16
+ append_javascript_pack_tag "decidim_comments", defer: false
17
+
18
+ inline_comments_for(resource, options)
16
19
  end
17
20
 
18
21
  # Creates a Comments component through the comments cell.
@@ -29,7 +29,7 @@ module Decidim
29
29
  Decidim::Api::MutationType.include MutationExtensions
30
30
  end
31
31
 
32
- initializer "decidim.stats" do
32
+ initializer "decidim_comments.stats" do
33
33
  Decidim.stats.register :comments_count, priority: StatsRegistry::MEDIUM_PRIORITY do |organization|
34
34
  Decidim.component_manifests.sum do |component|
35
35
  component.stats.filter(tag: :comments).with_context(organization.published_components).map { |_name, value| value }.sum
@@ -37,6 +37,19 @@ module Decidim
37
37
  end
38
38
  end
39
39
 
40
+ initializer "decidim_comments.register_icons" do
41
+ common_parameters = { category: "action", engine: :comments }
42
+
43
+ Decidim.icons.register(name: "Decidim::Comments::Comment", icon: "chat-1-line", description: "Comment", category: "activity", engine: :comments)
44
+ Decidim.icons.register(name: "comments_count", icon: "wechat-line", description: "Comments Count", category: "activity", engine: :comments)
45
+
46
+ Decidim.icons.register(name: "thumb-up-line", icon: "thumb-up-line", description: "Upvote comment button", **common_parameters)
47
+ Decidim.icons.register(name: "thumb-up-fill", icon: "thumb-up-fill", description: "User upvoted comment", **common_parameters)
48
+ Decidim.icons.register(name: "thumb-down-line", icon: "thumb-down-line", description: "Downvote comment button", **common_parameters)
49
+ Decidim.icons.register(name: "thumb-down-fill", icon: "thumb-down-fill", description: "User downvoted comment", **common_parameters)
50
+ Decidim.icons.register(name: "edit-line", icon: "edit-line", description: "Edit comment button", **common_parameters)
51
+ end
52
+
40
53
  initializer "decidim_comments.register_metrics" do
41
54
  Decidim.metrics_registry.register(:comments) do |metric_registry|
42
55
  metric_registry.manager_class = "Decidim::Comments::Metrics::CommentsMetricManage"
@@ -70,6 +83,23 @@ module Decidim
70
83
  initializer "decidim_comments.webpacker.assets_path" do
71
84
  Decidim.register_assets_path File.expand_path("app/packs", root)
72
85
  end
86
+
87
+ initializer "decidim_comments.authorization_transfer" do
88
+ config.to_prepare do
89
+ Decidim::AuthorizationTransfer.register(:comments) do |transfer|
90
+ transfer.move_records(Decidim::Comments::Comment, :decidim_author_id)
91
+ transfer.move_records(Decidim::Comments::CommentVote, :decidim_author_id)
92
+ end
93
+ end
94
+ end
95
+
96
+ initializer "decidim_comments.moderation_content" do
97
+ config.to_prepare do
98
+ ActiveSupport::Notifications.subscribe("decidim.admin.block_user:after") do |_event_name, data|
99
+ Decidim::Comments::HideAllCreatedByAuthorJob.perform_later(**data)
100
+ end
101
+ end
102
+ end
73
103
  end
74
104
  end
75
105
  end
@@ -12,9 +12,9 @@ module Decidim
12
12
  # Returns an Arel::Relation with all the comments for that component and resource.
13
13
  def comments_for_resource(resource_class, component)
14
14
  Comment
15
- .where(decidim_root_commentable_id: resource_class.where(component: component))
16
15
  .not_deleted
17
16
  .not_hidden
17
+ .where(decidim_root_commentable_id: resource_class.where(component:))
18
18
  .where(decidim_root_commentable_type: resource_class.to_s)
19
19
  end
20
20
 
@@ -4,11 +4,8 @@ require "decidim/core/test/factories"
4
4
 
5
5
  FactoryBot.define do
6
6
  factory :comment, class: "Decidim::Comments::Comment" do
7
- transient do
8
- skip_injection { false }
9
- end
10
- author { build(:user, organization: commentable.organization, skip_injection: skip_injection) }
11
- commentable { build(:dummy_resource, skip_injection: skip_injection) }
7
+ author { build(:user, organization: commentable.organization) }
8
+ commentable { build(:dummy_resource) }
12
9
  root_commentable { commentable }
13
10
  body { Decidim::Faker::Localized.paragraph }
14
11
  participatory_space { commentable.try(:participatory_space) }
@@ -28,26 +25,22 @@ FactoryBot.define do
28
25
  end
29
26
 
30
27
  trait :comment_on_comment do
31
- author { build(:user, organization: root_commentable.organization, skip_injection: skip_injection) }
28
+ author { build(:user, organization: root_commentable.organization) }
32
29
  commentable do
33
30
  build(
34
31
  :comment,
35
- author: author,
36
- root_commentable: root_commentable,
37
- commentable: root_commentable,
38
- skip_injection: skip_injection
32
+ author:,
33
+ root_commentable:,
34
+ commentable: root_commentable
39
35
  )
40
36
  end
41
- root_commentable { build(:dummy_resource, skip_injection: skip_injection) }
37
+ root_commentable { build(:dummy_resource) }
42
38
  end
43
39
  end
44
40
 
45
41
  factory :comment_vote, class: "Decidim::Comments::CommentVote" do
46
- transient do
47
- skip_injection { false }
48
- end
49
- comment { build(:comment, skip_injection: skip_injection) }
50
- author { build(:user, organization: comment.organization, skip_injection: skip_injection) }
42
+ comment { build(:comment) }
43
+ author { build(:user, organization: comment.organization) }
51
44
  weight { [-1, 1].sample }
52
45
 
53
46
  trait :up_vote do
@@ -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
@@ -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.6"
7
+ "0.28.0.rc4"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.6
4
+ version: 0.28.0.rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
8
8
  - Marc Riera Casals
9
9
  - Oriol Gual Oliva
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-04-30 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.6
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.6
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.6
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.6
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.6
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.6
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,27 +294,32 @@ 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: {}
303
- post_install_message:
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
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.2.22
319
- signing_key:
321
+ rubygems_version: 3.4.20
322
+ signing_key:
320
323
  specification_version: 4
321
324
  summary: Decidim comments module
322
325
  test_files: []
@@ -1 +0,0 @@
1
- <%== cell("decidim/author", author_presenter).profile %>