decidim-comments 0.22.0 → 0.23.3
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 +53 -53
- 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 +1 -1
- data/app/events/decidim/comments/comment_event.rb +1 -9
- data/app/forms/decidim/comments/comment_form.rb +8 -1
- data/app/frontend/comments/add_comment_form.component.test.tsx +30 -28
- data/app/frontend/comments/add_comment_form.component.tsx +32 -16
- data/app/frontend/comments/comment.component.test.tsx +35 -4
- data/app/frontend/comments/comment.component.tsx +24 -15
- 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 +28 -4
- data/app/frontend/comments/down_vote_button.component.tsx +24 -9
- data/app/frontend/comments/up_vote_button.component.tsx +24 -9
- 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 +2 -2
- data/app/frontend/support/schema.ts +1060 -735
- data/app/helpers/decidim/comments/comment_cells_helper.rb +33 -0
- data/app/models/decidim/comments/comment.rb +80 -21
- data/app/models/decidim/comments/seed.rb +1 -1
- data/app/types/decidim/comments/commentable_interface.rb +1 -1
- data/app/types/decidim/comments/commentable_mutation_type.rb +4 -1
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/bg.yml +6 -0
- data/config/locales/ca.yml +1 -0
- data/config/locales/cs.yml +2 -1
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +29 -28
- data/config/locales/en.yml +1 -0
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +1 -0
- data/config/locales/es-PY.yml +1 -0
- data/config/locales/es.yml +3 -2
- data/config/locales/et.yml +1 -0
- data/config/locales/fi-plain.yml +1 -0
- data/config/locales/fi.yml +2 -1
- data/config/locales/fr-CA.yml +2 -1
- data/config/locales/fr.yml +2 -1
- data/config/locales/gl.yml +13 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +1 -1
- data/config/locales/is-IS.yml +0 -2
- data/config/locales/is.yml +76 -0
- data/config/locales/it.yml +1 -0
- data/config/locales/ja-JP.yml +2 -2
- 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.yml +1 -0
- data/config/locales/{lv-LV.yml → lv.yml} +0 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +11 -10
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +6 -5
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sv.yml +1 -0
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +53 -33
- data/config/locales/uk.yml +0 -1
- 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/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/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/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 +1 -1
- data/lib/decidim/comments/version.rb +1 -1
- metadata +42 -14
@@ -0,0 +1 @@
|
|
1
|
+
si:
|
@@ -0,0 +1 @@
|
|
1
|
+
so:
|
data/config/locales/sv.yml
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
sw:
|
@@ -0,0 +1 @@
|
|
1
|
+
ti:
|
data/config/locales/tr-TR.yml
CHANGED
@@ -1,49 +1,52 @@
|
|
1
1
|
tr:
|
2
2
|
activemodel:
|
3
3
|
models:
|
4
|
-
decidim/comments/comment_by_followed_user_event: Yorum
|
5
|
-
decidim/comments/comment_created_event: Yorum
|
4
|
+
decidim/comments/comment_by_followed_user_event: Yorum
|
5
|
+
decidim/comments/comment_created_event: Yorum
|
6
6
|
decidim/comments/reply_created_event: Yorum cevabı
|
7
|
-
decidim/comments/user_group_mentioned_event:
|
8
|
-
decidim/comments/user_mentioned_event:
|
7
|
+
decidim/comments/user_group_mentioned_event: Bahset
|
8
|
+
decidim/comments/user_mentioned_event: Bahset
|
9
9
|
activerecord:
|
10
10
|
models:
|
11
11
|
decidim/comments/comment:
|
12
|
-
one: Yorum
|
12
|
+
one: Yorum
|
13
13
|
other: Yorumlar
|
14
14
|
decidim/comments/comment_vote:
|
15
|
-
one: Oy
|
15
|
+
one: Oy ver
|
16
16
|
other: oy
|
17
17
|
decidim:
|
18
18
|
comments:
|
19
19
|
comments: Yorumlar
|
20
|
+
comments_count: Yorum sayısı
|
20
21
|
last_activity:
|
21
|
-
new_comment_at_html: "<span> %{link}</span>yeni yorum"
|
22
|
+
new_comment_at_html: "<span> %{link}</span> yeni yorum"
|
23
|
+
view: Görünüm
|
22
24
|
votes:
|
23
25
|
create:
|
24
26
|
error: Yorum oylanırken bir sorun oluştu.
|
25
27
|
components:
|
26
28
|
add_comment_form:
|
27
|
-
account_message: <a href="%{sign_in_url}">
|
29
|
+
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
30
|
form:
|
29
31
|
body:
|
30
|
-
label: Yorum
|
32
|
+
label: Yorum
|
31
33
|
placeholder: Bunun hakkında ne düşünüyorsun?
|
32
|
-
form_error: Metin
|
33
|
-
submit:
|
34
|
+
form_error: Metin zorunludur ve %{length} karakterden uzun olamaz.
|
35
|
+
submit: Gönder
|
34
36
|
user_group_id:
|
35
37
|
label: Olarak yorum yap
|
36
38
|
opinion:
|
37
|
-
neutral:
|
39
|
+
neutral: Tarafsız
|
38
40
|
remaining_characters: "%{count} karakter kaldı"
|
39
41
|
remaining_characters_1: "%{count} karakter kaldı"
|
40
|
-
title:
|
42
|
+
title: Yorum Ekle
|
41
43
|
comment:
|
42
44
|
alignment:
|
43
45
|
against: Karşısında
|
44
46
|
in_favor: Lehine
|
45
47
|
deleted_user: Silinmiş katılımcı
|
46
|
-
|
48
|
+
hide_replies: Yanıtları gizle
|
49
|
+
reply: Cevapla
|
47
50
|
report:
|
48
51
|
action: Rapor
|
49
52
|
already_reported: Bu içerik zaten bildirildi ve bir yönetici tarafından incelenecek.
|
@@ -51,9 +54,12 @@ tr:
|
|
51
54
|
description: Bu içerik uygunsuz mu?
|
52
55
|
details: Ek Yorumlar
|
53
56
|
reasons:
|
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
|
57
|
+
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.
|
55
58
|
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.
|
56
59
|
spam: Clickbait, reklam, dolandırıcılık veya script botları içerir.
|
60
|
+
title: Uygunsuz içerik bildir
|
61
|
+
show_replies: '%{replies_count} yanıtı göster'
|
62
|
+
single_comment_link_title: Tek yorumun bağlantısını al
|
57
63
|
comment_order_selector:
|
58
64
|
order:
|
59
65
|
best_rated: En çok oy alan
|
@@ -66,33 +72,47 @@ tr:
|
|
66
72
|
comments:
|
67
73
|
blocked_comments_for_user_warning: Şu anda yorum yapamıyorsunuz, ancak öncekileri okuyabilirsiniz.
|
68
74
|
blocked_comments_warning: Yorumlar şu anda devre dışı, ancak öncekileri okuyabilirsiniz.
|
75
|
+
comment_details_title: Yorum ayrıntıları
|
69
76
|
loading: Yorumlar yükleniyor ...
|
77
|
+
single_comment_warning: Yorumların geri kalanını <a href="%{url}"> buradan </a> kontrol edebilirsiniz.
|
78
|
+
single_comment_warning_title: Tek bir yorum görüyorsunuz
|
70
79
|
title: "%{count} yorum"
|
80
|
+
down_vote_button:
|
81
|
+
text: Bu yoruma katılmıyorum
|
82
|
+
up_vote_button:
|
83
|
+
text: Bu yoruma katılıyorum
|
71
84
|
events:
|
72
85
|
comments:
|
73
86
|
comment_by_followed_user:
|
74
|
-
email_intro: "%{author_name}
|
75
|
-
email_outro:
|
76
|
-
email_subject: '%{author_name} %{resource_title}
|
77
|
-
notification_title: <a href="%{
|
87
|
+
email_intro: "%{author_name} grubu %{resource_title} alanında bir yorum bıraktı. Bu sayfada okuyabilirsiniz:"
|
88
|
+
email_outro: Bu bildirimi %{author_name} adlı yazarı takip ettiğiniz için aldınız. Bu grubu profil sayfasından takip etmeyi bırakabilirsiniz.
|
89
|
+
email_subject: '%{author_name} %{resource_title} alanında yeni bir yorum yaptı'
|
90
|
+
notification_title: <a href="%{resource_path}">%{resource_title} </a> içinde <a href="%{author_path}">%{author_name} %{author_nickname} </a> tarafından yeni bir yorum var.
|
78
91
|
comment_by_followed_user_group:
|
79
|
-
|
80
|
-
|
92
|
+
email_intro: '%{author_name} grubu %{resource_title} alanında bir yorum bıraktı. Bu sayfada okuyabilirsiniz:'
|
93
|
+
email_outro: Bu bildirimi %{author_name} adlı yazarı takip ettiğiniz için aldınız. Bu grubu profil sayfasından takip etmeyi bırakabilirsiniz.
|
94
|
+
email_subject: '%{author_name}, %{resource_title} alanında yeni bir yorum yaptı'
|
95
|
+
notification_title: <a href="%{resource_path}">%{resource_title} </a> içinde <a href="%{author_path}">%{author_name} %{author_nickname} </a> tarafından yeni bir yorum var.
|
81
96
|
comment_created:
|
82
|
-
email_intro: "%{resource_title} yorum yapıldı. Bu sayfadaki yorumu okuyabilirsiniz:"
|
83
|
-
email_outro: '"%{resource_title}" veya yazarı takip ettiğiniz için bu bildirimi aldınız. Bunu önceki linkten takip edebilirsiniz.'
|
84
|
-
email_subject: '%{author_name} %{resource_title}yeni bir yorum
|
85
|
-
notification_title: <a href="%{
|
97
|
+
email_intro: "%{resource_title} alanında yorum yapıldı. Bu sayfadaki yorumu okuyabilirsiniz:"
|
98
|
+
email_outro: '"%{resource_title}" alanında veya yazarı takip ettiğiniz için bu bildirimi aldınız. Bunu önceki linkten takip edebilirsiniz.'
|
99
|
+
email_subject: '%{author_name}, %{resource_title} alanında yeni bir yorum yaptı'
|
100
|
+
notification_title: <a href="%{resource_path}">%{resource_title} </a> içinde <a href="%{author_path}">%{author_name} %{author_nickname} </a> tarafından yeni bir yorum var
|
86
101
|
reply_created:
|
87
|
-
email_intro: "%{author_name}
|
102
|
+
email_intro: "%{author_name}, yorumunuzu %{resource_title} alanında yanıtladı. Bu sayfada okuyabilirsiniz:"
|
88
103
|
email_outro: Yorumunuz yanıtlandığı için bu bildirimi aldınız.
|
89
|
-
email_subject: "%{author_name}
|
90
|
-
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> <a href="%{resource_path}">%{resource_title}</a>yorumunuzu
|
104
|
+
email_subject: "%{author_name}, yorumunuzu %{resource_title} alanında yanıtladı"
|
105
|
+
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> <a href="%{resource_path}">%{resource_title}</a> alanında yorumunuzu yanıtladı
|
106
|
+
user_group_mentioned:
|
107
|
+
email_intro: Ait olduğunuz bir gruptan bahsedildi
|
108
|
+
email_outro: Bu bildirimi, %{resource_title} içinde adı geçen %{group_name} grubunun bir üyesi olduğunuz için aldınız.
|
109
|
+
email_subject: '%{resource_title} içinde %{group_name} üyesi olarak bahsedildiniz'
|
110
|
+
notification_title: <a href="%{resource_path}">%{resource_title} </a> ’de <a href="%{author_path}">%{author_name} %{author_nickname} </a> tarafından bir <a href="%{group_path}">%{group_name} %{group_nickname} </a> üyesi
|
91
111
|
user_mentioned:
|
92
|
-
email_intro: Sen
|
93
|
-
email_outro: Bu bildirimi, %{resource_title}
|
94
|
-
email_subject: '%{resource_title}
|
95
|
-
notification_title: <a href="%{resource_path}">%{resource_title}</a>
|
112
|
+
email_intro: Sen bahsedildin
|
113
|
+
email_outro: Bu bildirimi, sizden %{resource_title} alanında bahsedildiği için aldınız.
|
114
|
+
email_subject: '%{resource_title} alanında bahsedildiniz'
|
115
|
+
notification_title: <a href="%{resource_path}">%{resource_title} </a> alanında <a href="%{author_path}">%{author_name} %{author_nickname} </a> tarafından bahsedildi
|
96
116
|
metrics:
|
97
117
|
comments:
|
98
118
|
description: Katılımcılar tarafından oluşturulan yorum sayısı
|
@@ -100,4 +120,4 @@ tr:
|
|
100
120
|
title: Yorumlar
|
101
121
|
errors:
|
102
122
|
messages:
|
103
|
-
cannot_have_comments: yorum
|
123
|
+
cannot_have_comments: yorum alamaz
|
data/config/locales/uk.yml
CHANGED
@@ -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
|
@@ -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
|