decidim-comments 0.20.1 → 0.23.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim/comments/bundle.js +65 -65
- data/app/assets/javascripts/decidim/comments/bundle.js.map +1 -1
- data/app/cells/decidim/comments/comment_activity_cell.rb +2 -22
- data/app/cells/decidim/comments/comment_cell.rb +22 -0
- data/app/cells/decidim/comments/comment_m/footer.erb +5 -0
- data/app/cells/decidim/comments/comment_m/top.erb +7 -0
- data/app/cells/decidim/comments/comment_m_cell.rb +29 -0
- data/app/commands/decidim/comments/create_comment.rb +8 -8
- data/app/events/decidim/comments/comment_by_followed_user_group_event.rb +9 -0
- data/app/events/decidim/comments/comment_event.rb +28 -8
- data/app/events/decidim/comments/user_group_mentioned_event.rb +10 -0
- data/app/forms/decidim/comments/comment_form.rb +17 -1
- data/app/frontend/application/icon.component.tsx +16 -4
- data/app/frontend/comments/add_comment_form.component.test.tsx +31 -29
- data/app/frontend/comments/add_comment_form.component.tsx +34 -18
- data/app/frontend/comments/comment.component.test.tsx +36 -5
- data/app/frontend/comments/comment.component.tsx +311 -89
- data/app/frontend/comments/comment_order_selector.component.tsx +26 -7
- data/app/frontend/comments/comment_thread.component.test.tsx +9 -8
- data/app/frontend/comments/comment_thread.component.tsx +3 -1
- data/app/frontend/comments/comments.component.test.tsx +17 -14
- data/app/frontend/comments/comments.component.tsx +90 -9
- data/app/frontend/comments/down_vote_button.component.tsx +27 -9
- data/app/frontend/comments/up_vote_button.component.tsx +27 -9
- data/app/frontend/comments/vote_button.component.tsx +4 -0
- data/app/frontend/comments/vote_button_component.test.tsx +14 -8
- data/app/frontend/entry.ts +19 -0
- data/app/frontend/entry_test.ts +2 -0
- data/app/frontend/mutations/add_comment.mutation.graphql +2 -2
- data/app/frontend/mutations/down_vote.mutation.graphql +2 -2
- data/app/frontend/mutations/up_vote.mutation.graphql +2 -2
- data/app/frontend/queries/comments.query.graphql +3 -3
- data/app/frontend/support/schema.ts +326 -0
- data/app/helpers/decidim/comments/comment_cells_helper.rb +33 -0
- data/app/models/decidim/comments/comment.rb +96 -18
- data/app/models/decidim/comments/seed.rb +1 -1
- data/app/queries/decidim/comments/metrics/comments_metric_manage.rb +1 -6
- data/app/queries/decidim/comments/sorted_comments.rb +8 -2
- data/app/scrubbers/decidim/comments/user_input_scrubber.rb +20 -0
- data/app/services/decidim/comments/new_comment_notification_creator.rb +28 -3
- data/app/types/decidim/comments/commentable_interface.rb +3 -2
- data/app/types/decidim/comments/commentable_mutation_type.rb +6 -3
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +10 -1
- data/config/locales/bg-BG.yml +6 -0
- data/config/locales/bg.yml +6 -0
- data/config/locales/ca.yml +24 -1
- data/config/locales/cs.yml +36 -13
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +23 -1
- data/config/locales/el.yml +122 -0
- data/config/locales/en.yml +24 -1
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +24 -1
- data/config/locales/es-PY.yml +24 -1
- data/config/locales/es.yml +24 -1
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +4 -1
- data/config/locales/fi-plain.yml +24 -1
- data/config/locales/fi.yml +31 -8
- data/config/locales/fr-CA.yml +123 -0
- data/config/locales/fr.yml +25 -2
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +4 -1
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +18 -2
- data/config/locales/id-ID.yml +4 -1
- data/config/locales/is-IS.yml +3 -3
- data/config/locales/is.yml +76 -0
- data/config/locales/it.yml +23 -1
- data/config/locales/ja-JP.yml +120 -0
- data/config/locales/ja.yml +121 -0
- data/config/locales/ko-KR.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +118 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +26 -3
- data/config/locales/no.yml +24 -2
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +62 -40
- data/config/locales/pt-BR.yml +5 -2
- data/config/locales/pt.yml +47 -25
- data/config/locales/ro-RO.yml +124 -0
- data/config/locales/ru.yml +4 -1
- data/config/locales/sk-SK.yml +116 -0
- data/config/locales/sk.yml +120 -0
- data/config/locales/sl.yml +4 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +20 -0
- data/config/locales/sv.yml +26 -3
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +4 -1
- data/config/locales/uk.yml +4 -2
- data/config/locales/vi-VN.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +121 -0
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20200320105911_index_foreign_keys_in_decidim_comments_comments.rb +7 -0
- data/db/migrate/20200706123136_make_comments_handle_i18n.rb +41 -0
- data/db/migrate/20200828101910_add_commentable_counter_cache_to_comments.rb +9 -0
- data/lib/decidim/comments.rb +1 -0
- data/lib/decidim/comments/api/comment_type.rb +5 -1
- data/lib/decidim/comments/comment_serializer.rb +7 -2
- data/lib/decidim/comments/comment_vote_serializer.rb +5 -1
- data/lib/decidim/comments/commentable.rb +11 -0
- data/lib/decidim/comments/comments_helper.rb +28 -4
- data/lib/decidim/comments/engine.rb +13 -0
- data/lib/decidim/comments/markdown.rb +55 -0
- data/lib/decidim/comments/mutation_extensions.rb +8 -0
- data/lib/decidim/comments/query_extensions.rb +4 -0
- data/lib/decidim/comments/test/factories.rb +10 -1
- data/lib/decidim/comments/test/shared_examples/comment_event.rb +12 -2
- data/lib/decidim/comments/test/shared_examples/create_comment_context.rb +3 -2
- data/lib/decidim/comments/version.rb +1 -1
- metadata +71 -10
@@ -0,0 +1 @@
|
|
1
|
+
so:
|
@@ -0,0 +1,20 @@
|
|
1
|
+
sr:
|
2
|
+
decidim:
|
3
|
+
components:
|
4
|
+
comment:
|
5
|
+
hide_replies: Sakrij odgovore
|
6
|
+
show_replies: Prikaži %{replies_count} odgovora
|
7
|
+
single_comment_link_title: Nabavi vezu ka jednom komentaru
|
8
|
+
comments:
|
9
|
+
comment_details_title: Detalji o komentaru
|
10
|
+
single_comment_warning: Možete videti ostale komentare <a href="%{url}">ovde</a>.
|
11
|
+
single_comment_warning_title: Vidite samo jedan komentar
|
12
|
+
events:
|
13
|
+
comments:
|
14
|
+
comment_by_followed_user_group:
|
15
|
+
email_intro: 'Grupa %{author_name} je ostavila komentar na %{resource_title}. Možete ga pročitati na ovoj strani:'
|
16
|
+
user_group_mentioned:
|
17
|
+
email_intro: Grupa kojoj pripadate je pomenuta
|
18
|
+
email_outro: Dobili ste ovo obaveštenje jer ste član grupe %{group_name} koja je pomenuta u %{resource_title}.
|
19
|
+
email_subject: Pomenuti ste u %{resource_title} kao član grupe %{group_name}
|
20
|
+
notification_title: Pomenuti ste u <a href="%{resource_path}">%{resource_title}</a> od strane <a href="%{author_path}">%{author_name}%{author_nickname}</a> kao član <a href="%{group_path}">%{group_name}%{group_nickname}</a>
|
data/config/locales/sv.yml
CHANGED
@@ -3,7 +3,8 @@ sv:
|
|
3
3
|
models:
|
4
4
|
decidim/comments/comment_by_followed_user_event: Kommentar
|
5
5
|
decidim/comments/comment_created_event: Kommentar
|
6
|
-
decidim/comments/reply_created_event:
|
6
|
+
decidim/comments/reply_created_event: Svar till en kommentar
|
7
|
+
decidim/comments/user_group_mentioned_event: Nämn
|
7
8
|
decidim/comments/user_mentioned_event: Nämn
|
8
9
|
activerecord:
|
9
10
|
models:
|
@@ -16,8 +17,10 @@ sv:
|
|
16
17
|
decidim:
|
17
18
|
comments:
|
18
19
|
comments: Kommentarer
|
20
|
+
comments_count: Antal kommentarer
|
19
21
|
last_activity:
|
20
22
|
new_comment_at_html: "<span>Ny kommentar på %{link}</span>"
|
23
|
+
view: Visa
|
21
24
|
votes:
|
22
25
|
create:
|
23
26
|
error: Det gick inte att rösta om kommentaren.
|
@@ -42,6 +45,7 @@ sv:
|
|
42
45
|
against: Mot
|
43
46
|
in_favor: För
|
44
47
|
deleted_user: Raderad deltagare
|
48
|
+
hide_replies: Göm svar
|
45
49
|
reply: Svara
|
46
50
|
report:
|
47
51
|
action: Rapportera
|
@@ -53,7 +57,9 @@ sv:
|
|
53
57
|
does_not_belong: Innehåller olaglig aktivitet, självmordshot, personlig information eller något annat du tycker inte hör hemma på %{organization_name}.
|
54
58
|
offensive: Innehåller rasism, sexism, skällsord, personliga attacker, dödshot, uppmaningar att begå självmord eller någon form av hatpropaganda.
|
55
59
|
spam: Innehåller clickbait, reklam, bedrägerier eller skriptrobotar.
|
56
|
-
title: Rapportera
|
60
|
+
title: Rapportera olämpligt innehåll
|
61
|
+
show_replies: Visa %{replies_count} svar
|
62
|
+
single_comment_link_title: Få länk till enstaka kommentar
|
57
63
|
comment_order_selector:
|
58
64
|
order:
|
59
65
|
best_rated: Bästa betyg
|
@@ -66,8 +72,15 @@ sv:
|
|
66
72
|
comments:
|
67
73
|
blocked_comments_for_user_warning: Du kan inte kommentera just nu, men du kan läsa tidigare kommentarer.
|
68
74
|
blocked_comments_warning: Kommentarer är inaktiverade just nu, men du kan läsa de föregående.
|
75
|
+
comment_details_title: Kommentarsdetaljer
|
69
76
|
loading: Laddar kommentarer...
|
77
|
+
single_comment_warning: Läs återstående <a href="%{url}">kommentarer</a>.
|
78
|
+
single_comment_warning_title: Du visar en enda kommentar
|
70
79
|
title: "%{count} kommentarer"
|
80
|
+
down_vote_button:
|
81
|
+
text: Jag håller inte med om denna kommentar
|
82
|
+
up_vote_button:
|
83
|
+
text: Jag instämmer i denna kommentar
|
71
84
|
events:
|
72
85
|
comments:
|
73
86
|
comment_by_followed_user:
|
@@ -75,9 +88,14 @@ sv:
|
|
75
88
|
email_outro: Du har fått den här notisen eftersom du följer %{author_name}. Du kan avfölja den här användaren från deras profilsida.
|
76
89
|
email_subject: Det finns en ny kommentar av %{author_name} i %{resource_title}
|
77
90
|
notification_title: Det finns en ny kommentar av <a href="%{author_path}">%{author_name} %{author_nickname}</a> i <a href="%{resource_path}">%{resource_title}</a>.
|
91
|
+
comment_by_followed_user_group:
|
92
|
+
email_intro: 'Gruppen %{author_name} har lämnat en kommentar i %{resource_title}. Du kan läsa den på denna sida:'
|
93
|
+
email_outro: Du har fått det här meddelandet eftersom du följer %{author_name}. Du kan sluta följa den här gruppen från dess profilsida.
|
94
|
+
email_subject: Det finns en ny kommentar av %{author_name} i %{resource_title}
|
95
|
+
notification_title: Det finns en ny kommentar av <a href="%{author_path}">%{author_name} %{author_nickname}</a> i <a href="%{resource_path}">%{resource_title}</a>.
|
78
96
|
comment_created:
|
79
97
|
email_intro: "%{resource_title} har kommenterats. Du kan läsa kommentaren på den här sidan:"
|
80
|
-
email_outro: Du har fått
|
98
|
+
email_outro: Du har fått det här meddelandet eftersom du följer "%{resource_title}" eller dess författare. Du kan avfölja det från föregående länk.
|
81
99
|
email_subject: Det finns en ny kommentar från %{author_name} i %{resource_title}
|
82
100
|
notification_title: Det finns en ny kommentar från <a href="%{author_path}">%{author_name} %{author_nickname}</a> i <a href="%{resource_path}">%{resource_title}</a>
|
83
101
|
reply_created:
|
@@ -85,6 +103,11 @@ sv:
|
|
85
103
|
email_outro: Du har fått denna notis eftersom din kommentar blev besvarad.
|
86
104
|
email_subject: "%{author_name} har svarat din kommentar i %{resource_title}"
|
87
105
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> har svarat din kommentar i <a href="%{resource_path}">%{resource_title}</a>
|
106
|
+
user_group_mentioned:
|
107
|
+
email_intro: En grupp som du tillhör har nämnts
|
108
|
+
email_outro: Du har fått det här meddelandet eftersom du är medlem i gruppen %{group_name} som har nämnts i %{resource_title}.
|
109
|
+
email_subject: Du har nämnts i %{resource_title} som en medlem i %{group_name}
|
110
|
+
notification_title: Du har nämnts i <a href="%{resource_path}">%{resource_title}</a> av <a href="%{author_path}">%{author_name} %{author_nickname}</a> som medlem av <a href="%{group_path}">%{group_name} %{group_nickname}</a>
|
88
111
|
user_mentioned:
|
89
112
|
email_intro: Du har nämnts
|
90
113
|
email_outro: Du har fått denna notis eftersom du har nämnts i %{resource_title}.
|
@@ -0,0 +1 @@
|
|
1
|
+
ti:
|
data/config/locales/tr-TR.yml
CHANGED
@@ -4,6 +4,7 @@ tr:
|
|
4
4
|
decidim/comments/comment_by_followed_user_event: Yorum Yap
|
5
5
|
decidim/comments/comment_created_event: Yorum Yap
|
6
6
|
decidim/comments/reply_created_event: Yorum cevabı
|
7
|
+
decidim/comments/user_group_mentioned_event: Anma
|
7
8
|
decidim/comments/user_mentioned_event: Anma
|
8
9
|
activerecord:
|
9
10
|
models:
|
@@ -53,7 +54,6 @@ tr:
|
|
53
54
|
does_not_belong: Yasadışı faaliyet, intihar tehditleri, kişisel bilgiler veya %{organization_name}ait olmadığını düşündüğünüz başka bir şey içerir.
|
54
55
|
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.
|
55
56
|
spam: Clickbait, reklam, dolandırıcılık veya script botları içerir.
|
56
|
-
title: Sorun bildir
|
57
57
|
comment_order_selector:
|
58
58
|
order:
|
59
59
|
best_rated: En çok oy alan
|
@@ -75,6 +75,9 @@ tr:
|
|
75
75
|
email_outro: '%{author_name}takip ettiğiniz için bu bildirimi aldınız. Bu kullanıcıyı profil sayfasından takip edebilirsiniz.'
|
76
76
|
email_subject: '%{author_name} %{resource_title}tarafından yeni bir yorum var'
|
77
77
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> tarafından <a href="%{resource_path}">%{resource_title}</a>yeni bir yorum var.
|
78
|
+
comment_by_followed_user_group:
|
79
|
+
email_subject: '%{author_name} %{resource_title}tarafından yeni bir yorum var'
|
80
|
+
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> tarafından <a href="%{resource_path}">%{resource_title}</a>yeni bir yorum var.
|
78
81
|
comment_created:
|
79
82
|
email_intro: "%{resource_title} yorum yapıldı. Bu sayfadaki yorumu okuyabilirsiniz:"
|
80
83
|
email_outro: '"%{resource_title}" veya yazarı takip ettiğiniz için bu bildirimi aldınız. Bunu önceki linkten takip edebilirsiniz.'
|
data/config/locales/uk.yml
CHANGED
@@ -4,6 +4,7 @@ uk:
|
|
4
4
|
decidim/comments/comment_by_followed_user_event: Коментар
|
5
5
|
decidim/comments/comment_created_event: Коментар
|
6
6
|
decidim/comments/reply_created_event: Відповідь на коментар
|
7
|
+
decidim/comments/user_group_mentioned_event: Згадка
|
7
8
|
decidim/comments/user_mentioned_event: Згадка
|
8
9
|
activerecord:
|
9
10
|
models:
|
@@ -19,7 +20,6 @@ uk:
|
|
19
20
|
other: Голосів
|
20
21
|
decidim:
|
21
22
|
comments:
|
22
|
-
comments: Коментарі
|
23
23
|
votes:
|
24
24
|
create:
|
25
25
|
error: При голосуванні щодо коментаря сталися помилки.
|
@@ -55,7 +55,6 @@ uk:
|
|
55
55
|
does_not_belong: Містить незаконну діяльність, загрози самогубства, особисті відомості чи ще щось, неприпустиме, на вашу думку, для %{organization_name}.
|
56
56
|
offensive: Містить расизм, сексизм, образи, особисті напади, погрози вбивства, заяви про самогубство або будь-які ненависницькі висловлювання.
|
57
57
|
spam: Містить клацоловки (маніпулятивно-сенсаційні заголовки), рекламу, афери або лохотрони.
|
58
|
-
title: Поскаржитись на ускладнення
|
59
58
|
comment_order_selector:
|
60
59
|
order:
|
61
60
|
best_rated: З найкращим рейтингом
|
@@ -76,6 +75,9 @@ uk:
|
|
76
75
|
email_outro: Ви отримали це сповіщення, тому що ви стежите за %{author_name}. Ви можете припинити стежити за ним на сторінці його профілю.
|
77
76
|
email_subject: У %{resource_title} з'явився новий коментар від %{author_name}
|
78
77
|
notification_title: У <a href="%{resource_path}">%{resource_title}</a> з'явився новий коментар від <a href="%{author_path}">%{author_name} %{author_nickname}</a>.
|
78
|
+
comment_by_followed_user_group:
|
79
|
+
email_subject: У %{resource_title} з'явився новий коментар від %{author_name}
|
80
|
+
notification_title: У <a href="%{resource_path}">%{resource_title}</a> з'явився новий коментар від <a href="%{author_path}">%{author_name} %{author_nickname}</a>.
|
79
81
|
comment_created:
|
80
82
|
email_intro: "%{resource_title} прокоментували. Ви можете прочитати коментар на сторінці:"
|
81
83
|
email_outro: Ви отримали це сповіщення, тому що ви стежите за "%{resource_title}". Ви можете припинити стежити за ним, перейшовши за наведеним вище посиланням.
|
@@ -0,0 +1 @@
|
|
1
|
+
vi:
|
@@ -0,0 +1 @@
|
|
1
|
+
vi:
|
@@ -0,0 +1,121 @@
|
|
1
|
+
zh-CN:
|
2
|
+
activemodel:
|
3
|
+
models:
|
4
|
+
decidim/comments/comment_by_followed_user_event: 评论
|
5
|
+
decidim/comments/comment_created_event: 评论
|
6
|
+
decidim/comments/reply_created_event: 评论回复
|
7
|
+
decidim/comments/user_group_mentioned_event: 提到了
|
8
|
+
decidim/comments/user_mentioned_event: 提到了
|
9
|
+
activerecord:
|
10
|
+
models:
|
11
|
+
decidim/comments/comment:
|
12
|
+
other: 评论
|
13
|
+
decidim/comments/comment_vote:
|
14
|
+
other: 所得票数
|
15
|
+
decidim:
|
16
|
+
comments:
|
17
|
+
comments: 评论
|
18
|
+
comments_count: 评论计数
|
19
|
+
last_activity:
|
20
|
+
new_comment_at_html: "<span>在 %{link}的新评论</span>"
|
21
|
+
view: 查看
|
22
|
+
votes:
|
23
|
+
create:
|
24
|
+
error: 在表决该评论时出现问题。
|
25
|
+
components:
|
26
|
+
add_comment_form:
|
27
|
+
account_message: <a href="%{sign_in_url}">使用您的帐户</a> 或 <a href="%{sign_up_url}">注册</a> 来添加您的评论。
|
28
|
+
form:
|
29
|
+
body:
|
30
|
+
label: 评论
|
31
|
+
placeholder: 你对此有什么看法?
|
32
|
+
form_error: 文本是必需的,不能超过 %{length} 个字符。
|
33
|
+
submit: 发送
|
34
|
+
user_group_id:
|
35
|
+
label: 评论为
|
36
|
+
opinion:
|
37
|
+
neutral: 中性的
|
38
|
+
remaining_characters: "剩余 %{count} 个字符"
|
39
|
+
remaining_characters_1: "剩余 %{count} 个字符"
|
40
|
+
title: 添加您的评论
|
41
|
+
comment:
|
42
|
+
alignment:
|
43
|
+
against: 反对的
|
44
|
+
in_favor: 优惠的
|
45
|
+
deleted_user: 删除参与者
|
46
|
+
hide_replies: 隐藏回复
|
47
|
+
reply: 答复
|
48
|
+
report:
|
49
|
+
action: 报告
|
50
|
+
already_reported: 此内容已经被报告,将由管理员审核。
|
51
|
+
close: 关闭
|
52
|
+
description: 这个内容是否不适当?
|
53
|
+
details: 其他评论
|
54
|
+
reasons:
|
55
|
+
does_not_belong: 包含非法活动、自杀威胁、个人信息或你认为不属于 %{organization_name} 的其他东西。
|
56
|
+
offensive: 包括种族主义、性别主义、污泥、个人攻击、死亡威胁、自杀请求或任何形式的仇恨言论。
|
57
|
+
spam: 包含点击、广告、骗子或脚本机器人。
|
58
|
+
title: 报告不恰当的内容
|
59
|
+
show_replies: 显示 %{replies_count} 个回复
|
60
|
+
single_comment_link_title: 获取单个评论的链接
|
61
|
+
comment_order_selector:
|
62
|
+
order:
|
63
|
+
best_rated: 最佳评分
|
64
|
+
most_discussed: 最多讨论
|
65
|
+
older: 更旧的
|
66
|
+
recent: 最近的
|
67
|
+
title: '排序方式:'
|
68
|
+
comment_thread:
|
69
|
+
title: 与 %{authorName} 的对话
|
70
|
+
comments:
|
71
|
+
blocked_comments_for_user_warning: 您此时无法评论,但您可以阅读前面的评论。
|
72
|
+
blocked_comments_warning: 评论此时被禁用,但您可以阅读前面的评论。
|
73
|
+
comment_details_title: 评论详情
|
74
|
+
loading: 正在加载评论...
|
75
|
+
single_comment_warning: 您可以在这里查看 <a href="%{url}">的其余评论</a>。
|
76
|
+
single_comment_warning_title: 您正在看到一个评论
|
77
|
+
title: "%{count} 条评论"
|
78
|
+
down_vote_button:
|
79
|
+
text: 我不同意这个评论
|
80
|
+
up_vote_button:
|
81
|
+
text: 我同意这个评论
|
82
|
+
events:
|
83
|
+
comments:
|
84
|
+
comment_by_followed_user:
|
85
|
+
email_intro: "%{author_name} 在 %{resource_title}留下了一条评论。您可以在这个页面阅读:"
|
86
|
+
email_outro: 您收到此通知是因为您正在关注 %{author_name}。您可以从其个人资料页面取消关注此用户。
|
87
|
+
email_subject: '%{author_name} 在 %{resource_title} 有一个新评论'
|
88
|
+
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> 在 <a href="%{resource_path}">%{resource_title}</a> 有新的评论。
|
89
|
+
comment_by_followed_user_group:
|
90
|
+
email_intro: '组 %{author_name} 在 %{resource_title}留下了一个评论。您可以在这个页面阅读它:'
|
91
|
+
email_outro: 您收到此通知是因为您正在关注 %{author_name}。您可以从其个人资料页面取消关注此组。
|
92
|
+
email_subject: '%{author_name} 在 %{resource_title} 有一个新评论'
|
93
|
+
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> 在 <a href="%{resource_path}">%{resource_title}</a> 有新的评论。
|
94
|
+
comment_created:
|
95
|
+
email_intro: "%{resource_title} 已被评论。您可以阅读此页面中的评论:"
|
96
|
+
email_outro: 您收到此通知是因为您正在关注"%{resource_title}"或其作者。您可以从上一个链接取消关注它。
|
97
|
+
email_subject: '%{author_name} 在 %{resource_title} 有一个新评论'
|
98
|
+
notification_title: 来自 <a href="%{author_path}">%{author_name} %{author_nickname}</a> 的新评论 <a href="%{resource_path}">%{resource_title}</a>
|
99
|
+
reply_created:
|
100
|
+
email_intro: "%{author_name} 在 %{resource_title}回复了您的评论。您可以在这个页面阅读:"
|
101
|
+
email_outro: 您收到此通知是因为您的评论已被回复。
|
102
|
+
email_subject: "%{author_name} 在 %{resource_title} 回复了您的评论"
|
103
|
+
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> 回复了您在 <a href="%{resource_path}">%{resource_title}</a>
|
104
|
+
user_group_mentioned:
|
105
|
+
email_intro: 已经提到您所属的组
|
106
|
+
email_outro: 您收到此通知是因为您是在 %{group_name} 中提及的组 %{resource_title} 的成员。
|
107
|
+
email_subject: 您已在 %{resource_title} 中被提及为 %{group_name} 的成员
|
108
|
+
notification_title: 您在 <a href="%{resource_path}">%{resource_title}中提到</a> <a href="%{author_path}">%{author_name} %{author_nickname}</a> 作为 <a href="%{group_path}">%{group_name} %{group_nickname}</a>
|
109
|
+
user_mentioned:
|
110
|
+
email_intro: 您已被提到。
|
111
|
+
email_outro: 您收到此通知是因为您已在 %{resource_title} 中被提及。
|
112
|
+
email_subject: 您已在 %{resource_title} 中被提及了
|
113
|
+
notification_title: 您在 <a href="%{resource_path}">%{resource_title}中提到</a> <a href="%{author_path}">%{author_name} %{author_nickname}</a>
|
114
|
+
metrics:
|
115
|
+
comments:
|
116
|
+
description: 与会者生成的评论数
|
117
|
+
object: 评论
|
118
|
+
title: 评论
|
119
|
+
errors:
|
120
|
+
messages:
|
121
|
+
cannot_have_comments: 不能有评论
|
@@ -0,0 +1 @@
|
|
1
|
+
zh-TW:
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class MakeCommentsHandleI18n < ActiveRecord::Migration[5.2]
|
4
|
+
class User < ApplicationRecord
|
5
|
+
self.table_name = :decidim_users
|
6
|
+
end
|
7
|
+
|
8
|
+
class Comment < ApplicationRecord
|
9
|
+
self.table_name = :decidim_comments_comments
|
10
|
+
end
|
11
|
+
|
12
|
+
class Organization < ApplicationRecord
|
13
|
+
self.table_name = :decidim_organizations
|
14
|
+
end
|
15
|
+
|
16
|
+
def change
|
17
|
+
add_column :decidim_comments_comments, :new_body, :jsonb
|
18
|
+
|
19
|
+
User.reset_column_information
|
20
|
+
Comment.reset_column_information
|
21
|
+
Organization.reset_column_information
|
22
|
+
|
23
|
+
Comment.find_each do |comment|
|
24
|
+
locale, org_id = User.where(id: comment.decidim_author_id).pluck(:locale, :decidim_organization_id).first
|
25
|
+
locale = locale.presence || Organization.find(org_id).default_locale
|
26
|
+
|
27
|
+
comment.new_body = {
|
28
|
+
locale => comment.body
|
29
|
+
}
|
30
|
+
|
31
|
+
comment.save!
|
32
|
+
end
|
33
|
+
|
34
|
+
remove_column :decidim_comments_comments, :body
|
35
|
+
rename_column :decidim_comments_comments, :new_body, :body
|
36
|
+
|
37
|
+
User.reset_column_information
|
38
|
+
Comment.reset_column_information
|
39
|
+
Organization.reset_column_information
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddCommentableCounterCacheToComments < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
add_column :decidim_comments_comments, :comments_count, :integer, null: false, default: 0, index: true
|
6
|
+
Decidim::Comments::Comment.reset_column_information
|
7
|
+
Decidim::Comments::Comment.find_each(&:update_comments_count)
|
8
|
+
end
|
9
|
+
end
|
data/lib/decidim/comments.rb
CHANGED
@@ -17,6 +17,7 @@ module Decidim
|
|
17
17
|
autoload :CommentSerializer, "decidim/comments/comment_serializer"
|
18
18
|
autoload :CommentVoteSerializer, "decidim/comments/comment_vote_serializer"
|
19
19
|
autoload :Export, "decidim/comments/export"
|
20
|
+
autoload :Markdown, "decidim/comments/markdown"
|
20
21
|
|
21
22
|
def self.data_portable_entities
|
22
23
|
["Decidim::Comments::Comment", "Decidim::Comments::CommentVote"]
|
@@ -25,7 +25,11 @@ module Decidim
|
|
25
25
|
}
|
26
26
|
end
|
27
27
|
|
28
|
-
field :body, !types.String, "The comment message"
|
28
|
+
field :body, !types.String, "The comment message" do
|
29
|
+
resolve lambda { |obj, _args, _ctx|
|
30
|
+
obj.translated_body
|
31
|
+
}
|
32
|
+
end
|
29
33
|
|
30
34
|
field :formattedBody, !types.String, "The comment message ready to display (it is expected to include HTML)", property: :formatted_body
|
31
35
|
|
@@ -11,7 +11,8 @@ module Decidim
|
|
11
11
|
{
|
12
12
|
id: resource.id,
|
13
13
|
created_at: resource.created_at,
|
14
|
-
body: resource.body,
|
14
|
+
body: resource.body.values.first,
|
15
|
+
locale: resource.body.keys.first,
|
15
16
|
author: {
|
16
17
|
id: resource.author.id,
|
17
18
|
name: resource.author.name
|
@@ -31,7 +32,11 @@ module Decidim
|
|
31
32
|
private
|
32
33
|
|
33
34
|
def root_commentable_url
|
34
|
-
@root_commentable_url ||=
|
35
|
+
@root_commentable_url ||= if resource.root_commentable&.respond_to?(:polymorphic_resource_url)
|
36
|
+
resource.root_commentable.polymorphic_resource_url
|
37
|
+
else
|
38
|
+
ResourceLocatorPresenter.new(resource.root_commentable).url
|
39
|
+
end
|
35
40
|
end
|
36
41
|
end
|
37
42
|
end
|
@@ -37,7 +37,11 @@ module Decidim
|
|
37
37
|
private
|
38
38
|
|
39
39
|
def root_commentable_url
|
40
|
-
@root_commentable_url ||=
|
40
|
+
@root_commentable_url ||= if resource.comment.root_commentable&.respond_to?(:polymorphic_resource_url)
|
41
|
+
resource.comment.root_commentable.polymorphic_resource_url
|
42
|
+
else
|
43
|
+
ResourceLocatorPresenter.new(resource.comment.root_commentable).url
|
44
|
+
end
|
41
45
|
end
|
42
46
|
end
|
43
47
|
end
|
@@ -51,6 +51,17 @@ module Decidim
|
|
51
51
|
def user_allowed_to_comment?(_user)
|
52
52
|
true
|
53
53
|
end
|
54
|
+
|
55
|
+
# Public: Updates the comments counter cache. We have to do it these
|
56
|
+
# way in order to properly calculate the coutner with hidden
|
57
|
+
# comments.
|
58
|
+
#
|
59
|
+
# rubocop:disable Rails/SkipsModelValidations
|
60
|
+
def update_comments_count
|
61
|
+
comments_count = comments.not_hidden.count
|
62
|
+
update_columns(comments_count: comments_count, updated_at: Time.current)
|
63
|
+
end
|
64
|
+
# rubocop:enable Rails/SkipsModelValidations
|
54
65
|
end
|
55
66
|
end
|
56
67
|
end
|
@@ -26,9 +26,13 @@ module Decidim
|
|
26
26
|
commentable_type = resource.commentable_type
|
27
27
|
commentable_id = resource.id.to_s
|
28
28
|
node_id = "comments-for-#{commentable_type.demodulize}-#{commentable_id}"
|
29
|
-
react_comments_component(
|
30
|
-
|
31
|
-
|
29
|
+
react_comments_component(
|
30
|
+
node_id, commentableType: commentable_type,
|
31
|
+
commentableId: commentable_id,
|
32
|
+
locale: I18n.locale,
|
33
|
+
toggleTranslations: machine_translations_toggled?,
|
34
|
+
commentsMaxLength: comments_max_length(resource)
|
35
|
+
)
|
32
36
|
end
|
33
37
|
|
34
38
|
# Private: Render Comments component using inline javascript
|
@@ -44,11 +48,31 @@ module Decidim
|
|
44
48
|
{
|
45
49
|
commentableType: "#{props[:commentableType]}",
|
46
50
|
commentableId: "#{props[:commentableId]}",
|
47
|
-
locale: "#{props[:locale]}"
|
51
|
+
locale: "#{props[:locale]}",
|
52
|
+
toggleTranslations: #{props[:toggleTranslations]},
|
53
|
+
commentsMaxLength: "#{props[:commentsMaxLength]}"
|
48
54
|
}
|
49
55
|
);
|
50
56
|
})
|
51
57
|
end
|
58
|
+
|
59
|
+
def comments_max_length(resource)
|
60
|
+
return 1000 unless resource.respond_to?(:component)
|
61
|
+
return component_comments_max_length(resource) if component_comments_max_length(resource)
|
62
|
+
return organization_comments_max_length(resource) if organization_comments_max_length(resource)
|
63
|
+
|
64
|
+
1000
|
65
|
+
end
|
66
|
+
|
67
|
+
def component_comments_max_length(resource)
|
68
|
+
return unless resource.component&.settings.respond_to?(:comments_max_length)
|
69
|
+
|
70
|
+
resource.component.settings.comments_max_length if resource.component.settings.comments_max_length.positive?
|
71
|
+
end
|
72
|
+
|
73
|
+
def organization_comments_max_length(resource)
|
74
|
+
resource.component.organization.comments_max_length if resource.component.organization.comments_max_length.positive?
|
75
|
+
end
|
52
76
|
end
|
53
77
|
end
|
54
78
|
end
|