decidim-comments 0.27.8 → 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 +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 -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
@@ -21,20 +21,15 @@ ru:
21
21
  other: Голосов
22
22
  decidim:
23
23
  comments:
24
- comments_title: Комментарии
25
- last_activity:
26
- new_comment_at_html: "<span>Новый комментарий в %{link}</span>"
27
24
  votes:
28
25
  create:
29
26
  error: При голосовании за комментарий произошли ошибки.
30
27
  components:
31
28
  add_comment_form:
32
- account_message: <a href="%{sign_in_url}">Войдите в систему через свою учетную запись</a> или <a href="%{sign_up_url}">зарегистрируйтесь</a>, чтобы добавить свой комментарий.
33
29
  form:
34
30
  body:
35
31
  label: Комментарий
36
32
  placeholder: Что вы думаете об этом?
37
- form_error: Тут обязательно нужно ввести текст, но не больше %{length} символов.
38
33
  user_group_id:
39
34
  label: Комментировать как
40
35
  opinion:
@@ -55,7 +50,6 @@ ru:
55
50
  description: Это сообщение неприемлемо?
56
51
  details: Дополнительные комментарии
57
52
  reasons:
58
- does_not_belong: Содержит незаконную деятельность, угрозы самоубийства, личные сведения или что-то еще, недопустимое, на ваш взгляд, для %{organization_name}.
59
53
  offensive: Содержит расизм, сексизм, оскорбления, личные нападки, угрозы убийства, заявления о самоубийстве, или любую форму разжигания ненависти.
60
54
  spam: Содержит кликоловки (манипулятивно-сенсационные заголовки), рекламу, мошенничество или лохотроны.
61
55
  comment_order_selector:
@@ -65,8 +59,6 @@ ru:
65
59
  older: Старые
66
60
  recent: Недавние
67
61
  title: 'Упорядочить по:'
68
- comment_thread:
69
- title: Беседа с %{authorName}
70
62
  comments:
71
63
  blocked_comments_for_user_warning: Сейчас вам недоступно комментирование, но вы можете прочесть предыдущие комментарии.
72
64
  blocked_comments_warning: Комментарии сейчас отключены, но вы можете прочитать предыдущие.
@@ -101,6 +93,3 @@ ru:
101
93
  description: Количество комментариев, созданных участниками
102
94
  object: коментарии
103
95
  title: Комментарии
104
- errors:
105
- messages:
106
- cannot_have_comments: не подлежит комментированию
@@ -21,20 +21,15 @@ sk:
21
21
  other: Hlasy
22
22
  decidim:
23
23
  comments:
24
- comments_title: Komentáre
25
- last_activity:
26
- new_comment_at_html: "<span>Nový komentár na %{link}</span>"
27
24
  votes:
28
25
  create:
29
26
  error: Pri hlasovaní za komentár sa vyskytol problém.
30
27
  components:
31
28
  add_comment_form:
32
- account_message: <a href="%{sign_in_url}">Prihláste sa so svojím účtom</a> alebo <a href="%{sign_up_url}"> sa zaregistrujte</a>, aby ste pridali svoj komentár.
33
29
  form:
34
30
  body:
35
31
  label: Komentár
36
32
  placeholder: Čo si myslíte o tomto?
37
- form_error: Tento text je požadovaný a nesmie byť dlhší, než %{length} znakov.
38
33
  user_group_id:
39
34
  label: Komentovať ako
40
35
  opinion:
@@ -56,7 +51,6 @@ sk:
56
51
  description: Je tento obsah nevhodný?
57
52
  details: Ďalšie komentáre
58
53
  reasons:
59
- does_not_belong: Obsahuje ilegálnu činnosť, vyhrážky, osobné informácie, alebo niečo ďalšie, o čom si myslíte, že nepatrí na %{organization_name}.
60
54
  offensive: Obsahuje rasizmus, sexizmus, urážky, osobné útoky, vyhrážky alebo inú podobu nenávistného prejavu.
61
55
  spam: Obsahuje clickbait, reklamy, scam alebo je to skriptovací robot.
62
56
  comment_order_selector:
@@ -66,8 +60,6 @@ sk:
66
60
  older: Staršie
67
61
  recent: Nedávne
68
62
  title: 'Zoradiť podľa:'
69
- comment_thread:
70
- title: Konverzácia s %{authorName}
71
63
  comments:
72
64
  blocked_comments_for_user_warning: V súčasnosti nemôžete komentovať, ale môžete si prečítať predchádzajúce komentáre.
73
65
  blocked_comments_warning: Komentáre nie sú v súčasnosti povolené, ale môžete si prečítať predchádzajúce komentáre.
@@ -111,6 +103,3 @@ sk:
111
103
  description: Počet komentárov všetkých účastníkov
112
104
  object: komentáre
113
105
  title: Komentáre
114
- errors:
115
- messages:
116
- cannot_have_comments: nie je možné komentovať
@@ -1,39 +1 @@
1
- ---
2
1
  sq:
3
- decidim:
4
- components:
5
- add_comment_form:
6
- form:
7
- user_group_id:
8
- label: Komento si
9
- opinion:
10
- label: Mendimi jot mbi këtë temë
11
- negative: Negativ
12
- negative_selected: Mendimi jot mbi këtë temë është negativ
13
- neutral: Neutral
14
- neutral_selected: Mendimi jot mbi këtë temë është neutral
15
- positive: Pozitiv
16
- positive_selected: Mendimi jot mbi këtë temë është pozitiv
17
- remaining_characters: "%{count} karaktere të mbetura"
18
- remaining_characters_1: "%{count} karakter i mbetur"
19
- title: Shto komentin tënd
20
- comment:
21
- alignment:
22
- against: Kundër
23
- in_favor: Pro
24
- confirm_destroy: A je i sigurt që do ta fshish këtë koment?
25
- delete: Fshi
26
- deleted_at: Komenti u fshi në datën %{date}
27
- edit: Përpuno
28
- edited: Ndryshuar
29
- hide_replies: Fshih përgjigjet
30
- moderated_at: Komenti u moderua në datën %{date}
31
- reply: Përgjigju
32
- report:
33
- action: Raporto
34
- already_reported: Kjo përmbajtje është raportuar nga të tjerë dhe do rishikohet nga administratorët.
35
- close: Mbyll
36
- description: Përmbajtje e papërshtatshme?
37
- details: Komente të tjera
38
- reasons:
39
- offensive: Përmban racizëm, seksizëm, ofendime, sulme personale, kërcënime me vdekje, shtyrje për vetëvrasje apo forma të tjera të gjuhës së urrejtjes.
@@ -27,27 +27,19 @@ sv:
27
27
  comments:
28
28
  create:
29
29
  error: Det gick inte att skapa kommentaren.
30
- delete:
31
- error: Kommentaren kunde inte tas bort.
32
30
  update:
33
31
  error: Det gick inte att uppdatera kommentaren.
34
- comments_count: Antal kommentarer
35
- comments_title: Kommentarer
36
- last_activity:
37
- new_comment_at_html: "<span>Ny kommentar på %{link}</span>"
38
- view: Visa
32
+ comments_title: Kommentar
39
33
  votes:
40
34
  create:
41
35
  error: Det gick inte att rösta om kommentaren.
42
36
  components:
43
37
  add_comment_form:
44
- account_message: <a href="%{sign_in_url}">Logga in med ditt konto</a> eller <a href="%{sign_up_url}">registrera dig</a> för att lägga till din kommentar.
45
38
  form:
46
39
  body:
47
40
  label: Kommentera
48
41
  placeholder: Vad tycker du om detta?
49
- form_error: Texten är obligatorisk och den kan inte vara längre än %{length} tecken.
50
- submit: Skicka
42
+ submit_reply: Publicera svar
51
43
  user_group_id:
52
44
  label: Kommentera som
53
45
  opinion:
@@ -81,7 +73,6 @@ sv:
81
73
  description: Är detta innehåll olämpligt?
82
74
  details: Ytterligare kommentarer
83
75
  reasons:
84
- does_not_belong: Innehåller olaglig aktivitet, självmordshot, personlig information eller något annat du tycker inte hör hemma på %{organization_name}.
85
76
  offensive: Innehåller rasism, sexism, skällsord, personliga attacker, dödshot, uppmaningar att begå självmord eller någon form av hatpropaganda.
86
77
  spam: Innehåller clickbait, reklam, bedrägerier eller skriptrobotar.
87
78
  title: Rapportera olämpligt innehåll
@@ -96,8 +87,6 @@ sv:
96
87
  older: Äldre
97
88
  recent: Senaste
98
89
  title: 'Sortera efter:'
99
- comment_thread:
100
- title: Samtal med %{authorName}
101
90
  comments:
102
91
  blocked_comments_for_unauthorized_user_warning: Du behöver verifiera dig för att kunna kommentera just nu, men du kan läsa tidigare kommentarer.
103
92
  blocked_comments_for_user_warning: Du kan inte kommentera just nu, men du kan läsa tidigare kommentarer.
@@ -168,6 +157,3 @@ sv:
168
157
  description: Antal kommentarer från deltagare
169
158
  object: kommentarer
170
159
  title: Kommentarer
171
- errors:
172
- messages:
173
- cannot_have_comments: kan inte ha kommentarer
@@ -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,32 +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) }
42
- end
43
-
44
- trait :moderated do
45
- after(:create) do |comment, evaluator|
46
- create(:moderation, reportable: comment, hidden_at: 2.days.ago, skip_injection: evaluator.skip_injection)
47
- end
37
+ root_commentable { build(:dummy_resource) }
48
38
  end
49
39
  end
50
40
 
51
41
  factory :comment_vote, class: "Decidim::Comments::CommentVote" do
52
- transient do
53
- skip_injection { false }
54
- end
55
- comment { build(:comment, skip_injection: skip_injection) }
56
- author { build(:user, organization: comment.organization, skip_injection: skip_injection) }
42
+ comment { build(:comment) }
43
+ author { build(:user, organization: comment.organization) }
57
44
  weight { [-1, 1].sample }
58
45
 
59
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
@@ -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