decidim-comments 0.27.4 → 0.28.0.rc5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/comments/comment/actions.erb +13 -7
- data/app/cells/decidim/comments/comment/alignment_badge.erb +1 -4
- data/app/cells/decidim/comments/comment/deletion_data.erb +9 -1
- data/app/cells/decidim/comments/comment/moderation_data.erb +1 -1
- data/app/cells/decidim/comments/comment/replies.erb +3 -0
- data/app/cells/decidim/comments/comment/show.erb +72 -35
- data/app/cells/decidim/comments/comment/votes.erb +14 -14
- data/app/cells/decidim/comments/comment_activity_cell.rb +11 -7
- data/app/cells/decidim/comments/comment_card_cell.rb +2 -2
- data/app/cells/decidim/comments/comment_cell.rb +5 -15
- data/app/cells/decidim/comments/comment_form/comment_as.erb +3 -3
- data/app/cells/decidim/comments/comment_form/opinion.erb +18 -0
- data/app/cells/decidim/comments/comment_form/show.erb +33 -16
- data/app/cells/decidim/comments/comment_form_cell.rb +11 -3
- data/app/cells/decidim/comments/comment_metadata_cell.rb +27 -0
- data/app/cells/decidim/comments/comment_s_cell.rb +27 -0
- data/app/cells/decidim/comments/comment_thread/show.erb +2 -5
- data/app/cells/decidim/comments/comment_thread_cell.rb +0 -6
- data/app/cells/decidim/comments/comments/add_comment.erb +1 -20
- data/app/cells/decidim/comments/comments/blocked_comments_warning.erb +1 -3
- data/app/cells/decidim/comments/comments/comments_loading.erb +1 -3
- data/app/cells/decidim/comments/comments/order_control.erb +11 -35
- data/app/cells/decidim/comments/comments/show.erb +8 -9
- data/app/cells/decidim/comments/comments/single_comment_warning.erb +6 -9
- data/app/cells/decidim/comments/comments/user_comments_blocked_warning.erb +9 -6
- data/app/cells/decidim/comments/comments_cell.rb +1 -1
- data/app/cells/decidim/comments/edit_comment_modal_form/show.erb +20 -15
- data/app/commands/decidim/comments/create_comment.rb +17 -5
- data/app/commands/decidim/comments/delete_comment.rb +1 -1
- data/app/commands/decidim/comments/update_comment.rb +14 -2
- data/app/commands/decidim/comments/vote_comment.rb +1 -1
- data/app/controllers/decidim/comments/comments_controller.rb +14 -9
- data/app/controllers/decidim/comments/votes_controller.rb +1 -1
- data/app/events/decidim/comments/comment_by_followed_user_event.rb +1 -1
- data/app/events/decidim/comments/comment_by_followed_user_group_event.rb +1 -1
- data/app/events/decidim/comments/comment_event.rb +2 -3
- data/app/events/decidim/comments/reply_created_event.rb +1 -1
- data/app/events/decidim/comments/user_group_mentioned_event.rb +1 -1
- data/app/events/decidim/comments/user_mentioned_event.rb +1 -1
- data/app/helpers/decidim/comments/comment_cells_helper.rb +1 -1
- data/app/jobs/decidim/comments/hide_all_created_by_author_job.rb +13 -0
- data/app/models/decidim/comments/comment.rb +8 -4
- data/app/models/decidim/comments/seed.rb +30 -14
- data/app/packs/entrypoints/decidim_comments.js +5 -0
- data/app/packs/src/decidim/comments/comments.component.js +27 -36
- data/app/packs/src/decidim/comments/comments.component.test.js +218 -240
- data/app/packs/src/decidim/comments/comments.component_for_testing.js +1 -1
- data/app/packs/src/decidim/comments/comments.js +20 -1
- data/app/packs/stylesheets/comments.scss +327 -0
- data/app/queries/decidim/comments/metrics/comments_metric_manage.rb +1 -1
- data/app/queries/decidim/comments/sorted_comments.rb +10 -10
- data/app/services/decidim/comments/comment_creation.rb +1 -1
- data/app/services/decidim/comments/new_comment_notification_creator.rb +8 -8
- data/app/views/decidim/comments/admin/shared/_availability_fields.html.erb +4 -9
- data/app/views/decidim/comments/comments/_comment.html.erb +1 -1
- data/app/views/decidim/comments/comments/_comments.html.erb +1 -1
- data/app/views/decidim/comments/comments/_delete.html.erb +2 -4
- data/app/views/decidim/comments/comments/_moderated.html.erb +2 -4
- data/app/views/decidim/comments/comments/create.js.erb +5 -3
- data/app/views/decidim/comments/comments/delete.js.erb +4 -1
- data/app/views/decidim/comments/comments/index.js.erb +8 -1
- data/app/views/decidim/comments/comments/reload.js.erb +1 -2
- data/app/views/decidim/comments/comments/update.js.erb +5 -4
- data/app/views/decidim/comments/votes/create.js.erb +5 -5
- data/config/assets.rb +3 -0
- data/config/environment.rb +3 -0
- data/config/locales/ar.yml +0 -16
- data/config/locales/ca.yml +8 -10
- data/config/locales/cs.yml +8 -10
- data/config/locales/de.yml +6 -8
- data/config/locales/el.yml +3 -11
- data/config/locales/en.yml +10 -12
- data/config/locales/es-MX.yml +10 -12
- data/config/locales/es-PY.yml +10 -12
- data/config/locales/es.yml +9 -11
- data/config/locales/eu.yml +26 -28
- data/config/locales/fi-plain.yml +7 -9
- data/config/locales/fi.yml +7 -9
- data/config/locales/fr-CA.yml +9 -11
- data/config/locales/fr.yml +9 -11
- data/config/locales/ga-IE.yml +0 -4
- data/config/locales/gl.yml +0 -16
- data/config/locales/hu.yml +5 -11
- data/config/locales/id-ID.yml +0 -11
- data/config/locales/is-IS.yml +0 -8
- data/config/locales/it.yml +0 -16
- data/config/locales/ja.yml +10 -12
- data/config/locales/lb.yml +0 -16
- data/config/locales/lt.yml +12 -10
- data/config/locales/lv.yml +0 -11
- data/config/locales/nl.yml +0 -16
- data/config/locales/no.yml +0 -16
- data/config/locales/pl.yml +16 -10
- data/config/locales/pt-BR.yml +0 -16
- data/config/locales/pt.yml +0 -16
- data/config/locales/ro-RO.yml +2 -10
- data/config/locales/ru.yml +0 -11
- data/config/locales/sk.yml +0 -11
- data/config/locales/sq-AL.yml +1 -0
- data/config/locales/sv.yml +5 -16
- data/config/locales/th-TH.yml +1 -0
- data/config/locales/tr-TR.yml +1 -13
- data/config/locales/uk.yml +0 -8
- data/config/locales/zh-CN.yml +0 -13
- data/config/locales/zh-TW.yml +1 -9
- data/lib/decidim/api/commentable_interface.rb +1 -1
- data/lib/decidim/comments/comment_serializer.rb +2 -2
- data/lib/decidim/comments/comment_vote_serializer.rb +2 -2
- data/lib/decidim/comments/commentable.rb +1 -1
- data/lib/decidim/comments/comments_helper.rb +6 -3
- data/lib/decidim/comments/engine.rb +31 -1
- data/lib/decidim/comments/export.rb +1 -1
- data/lib/decidim/comments/test/factories.rb +2 -2
- data/lib/decidim/comments/test/shared_examples/comment_event.rb +3 -3
- data/lib/decidim/comments/test/shared_examples/comment_voted_event.rb +3 -3
- data/lib/decidim/comments/test/shared_examples/create_comment_context.rb +5 -5
- data/lib/decidim/comments/test/shared_examples/has_comments_availability_attributes.rb +2 -2
- data/lib/decidim/comments/test/shared_examples/translatable_comment.rb +3 -3
- data/lib/decidim/comments/version.rb +1 -1
- metadata +28 -20
- data/app/cells/decidim/comments/comment/author.erb +0 -1
- data/app/cells/decidim/comments/comment/utilities.erb +0 -41
- data/app/cells/decidim/comments/comment_m/footer.erb +0 -5
- data/app/cells/decidim/comments/comment_m/top.erb +0 -7
- data/app/cells/decidim/comments/comment_m_cell.rb +0 -29
- data/app/cells/decidim/comments/comment_thread/title.erb +0 -3
data/config/locales/uk.yml
CHANGED
@@ -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: не підлягає коментуванню
|
data/config/locales/zh-CN.yml
CHANGED
@@ -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: 不能有评论
|
data/config/locales/zh-TW.yml
CHANGED
@@ -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: 無法評論
|
@@ -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
|
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:
|
28
|
+
root_commentable_url:
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
@@ -33,7 +33,7 @@ module Decidim
|
|
33
33
|
|
34
34
|
def root_commentable_url
|
35
35
|
@root_commentable_url ||= if resource.root_commentable.respond_to?(:polymorphic_resource_url)
|
36
|
-
resource.root_commentable.polymorphic_resource_url
|
36
|
+
resource.root_commentable.polymorphic_resource_url({})
|
37
37
|
else
|
38
38
|
ResourceLocatorPresenter.new(resource.root_commentable).url
|
39
39
|
end
|
@@ -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:
|
29
|
+
root_commentable_url:
|
30
30
|
|
31
31
|
},
|
32
32
|
created_at: resource.created_at,
|
@@ -38,7 +38,7 @@ module Decidim
|
|
38
38
|
|
39
39
|
def root_commentable_url
|
40
40
|
@root_commentable_url ||= if resource.comment.root_commentable.respond_to?(:polymorphic_resource_url)
|
41
|
-
resource.comment.root_commentable.polymorphic_resource_url
|
41
|
+
resource.comment.root_commentable.polymorphic_resource_url({})
|
42
42
|
else
|
43
43
|
ResourceLocatorPresenter.new(resource.comment.root_commentable).url
|
44
44
|
end
|
@@ -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
|
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
|
-
|
14
|
-
|
15
|
-
|
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 "
|
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
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
|
-
shared_context "when it
|
5
|
+
shared_context "when it is a comment event" do
|
6
6
|
include Decidim::ComponentPathHelper
|
7
7
|
include Decidim::SanitizeHelper
|
8
8
|
|
@@ -18,8 +18,8 @@ shared_context "when it's a comment event" do
|
|
18
18
|
let(:extra) { { comment_id: comment.id } }
|
19
19
|
let(:resource_title) { decidim_html_escape(translated(resource.title)) }
|
20
20
|
let(:user_group) do
|
21
|
-
user_group = create(:user_group, :verified, organization
|
22
|
-
comment.update!(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,15 +3,15 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
5
|
shared_examples_for "a comment voted event" do
|
6
|
-
include_context "when it
|
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:
|
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
|
14
|
+
let(:extra) { { comment_id: comment.id, author_id: comment_vote_author.id, weight:, downvotes: 100, upvotes: 999 } }
|
15
15
|
let(:resource_title) { decidim_html_escape(translated(resource.title)) }
|
16
16
|
let(:resource_text) { subject.resource_text }
|
17
17
|
|
@@ -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:
|
5
|
+
let(:participatory_process) { create(:participatory_process, organization:) }
|
6
6
|
let(:component) { create(:component, participatory_space: participatory_process) }
|
7
|
-
let(:user) { create(:user, organization:
|
8
|
-
let(:author) { create(:user, organization:
|
9
|
-
let(:dummy_resource) { create :dummy_resource, 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) {
|
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:
|
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
|
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:
|
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:
|
12
|
-
let(:comment) { create :comment, body
|
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
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-comments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.28.0.rc5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-12-18 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.
|
21
|
+
version: 0.28.0.rc5
|
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.
|
28
|
+
version: 0.28.0.rc5
|
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.
|
55
|
+
version: 0.28.0.rc5
|
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.
|
62
|
+
version: 0.28.0.rc5
|
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.
|
69
|
+
version: 0.28.0.rc5
|
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.
|
76
|
+
version: 0.28.0.rc5
|
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/
|
103
|
-
- app/cells/decidim/comments/
|
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
|
@@ -234,9 +235,11 @@ files:
|
|
234
235
|
- config/locales/sk.yml
|
235
236
|
- config/locales/sl.yml
|
236
237
|
- config/locales/so-SO.yml
|
238
|
+
- config/locales/sq-AL.yml
|
237
239
|
- config/locales/sr-CS.yml
|
238
240
|
- config/locales/sv.yml
|
239
241
|
- config/locales/sw-KE.yml
|
242
|
+
- config/locales/th-TH.yml
|
240
243
|
- config/locales/ti-ER.yml
|
241
244
|
- config/locales/tr-TR.yml
|
242
245
|
- config/locales/uk.yml
|
@@ -292,10 +295,15 @@ files:
|
|
292
295
|
- lib/decidim/comments/test/shared_examples/translatable_comment.rb
|
293
296
|
- lib/decidim/comments/version.rb
|
294
297
|
- lib/tasks/decidim_comments.rake
|
295
|
-
homepage: https://
|
298
|
+
homepage: https://decidim.org
|
296
299
|
licenses:
|
297
300
|
- AGPL-3.0
|
298
|
-
metadata:
|
301
|
+
metadata:
|
302
|
+
bug_tracker_uri: https://github.com/decidim/decidim/issues
|
303
|
+
documentation_uri: https://docs.decidim.org/
|
304
|
+
funding_uri: https://opencollective.com/decidim
|
305
|
+
homepage_uri: https://decidim.org
|
306
|
+
source_code_uri: https://github.com/decidim/decidim
|
299
307
|
post_install_message:
|
300
308
|
rdoc_options: []
|
301
309
|
require_paths:
|
@@ -304,14 +312,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
304
312
|
requirements:
|
305
313
|
- - ">="
|
306
314
|
- !ruby/object:Gem::Version
|
307
|
-
version: '3.
|
315
|
+
version: '3.1'
|
308
316
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
309
317
|
requirements:
|
310
|
-
- - "
|
318
|
+
- - ">"
|
311
319
|
- !ruby/object:Gem::Version
|
312
|
-
version:
|
320
|
+
version: 1.3.1
|
313
321
|
requirements: []
|
314
|
-
rubygems_version: 3.
|
322
|
+
rubygems_version: 3.4.22
|
315
323
|
signing_key:
|
316
324
|
specification_version: 4
|
317
325
|
summary: Decidim comments module
|
@@ -1 +0,0 @@
|
|
1
|
-
<%== cell("decidim/author", author_presenter).profile %>
|
@@ -1,41 +0,0 @@
|
|
1
|
-
<div class="comment__header__context-menu">
|
2
|
-
<label for="<%= context_menu_id %>" data-toggle="<%= context_menu_id %>">
|
3
|
-
<%= icon "ellipses" %>
|
4
|
-
</label>
|
5
|
-
<ul id="<%= context_menu_id %>" data-dropdown data-close-on-click="true" data-position="left" data-alignment="top" class="card dropdown-pane comment__header__context-menu__content">
|
6
|
-
<li>
|
7
|
-
<button type="button" class="link-alt comment__header__context-menu__content-item" data-open="<%= current_user.present? ? "flagModalComment#{model.id}" : "loginModal" %>" title="<%= t("decidim.components.comment.report.title") %>" aria-controls="<%= current_user.present? ? "flagModalComment#{model.id}" : "loginModal" %>" aria-haspopup="dialog" tabindex="0">
|
8
|
-
<%= icon "flag", class: "icon--small", aria_label: t("decidim.components.comment.report.title") %>
|
9
|
-
<span><%= t("decidim.components.comment.report.action") %></span>
|
10
|
-
</button>
|
11
|
-
</li>
|
12
|
-
<li>
|
13
|
-
<%= link_to "#{commentable_path("commentId" => model.id)}#comment_#{model.id}", target: "_blank", class: "comment__header__context-menu__content-item", title: t("decidim.components.comment.single_comment_link_title") do %>
|
14
|
-
<%= icon "link-intact", class: "icon--small", aria_label: t("decidim.components.comment.single_comment_link_title") %>
|
15
|
-
<span><%= t("decidim.components.comment.single_comment_link_title") %></span>
|
16
|
-
<% end %>
|
17
|
-
</li>
|
18
|
-
<% if model.authored_by?(current_user) %>
|
19
|
-
<li>
|
20
|
-
<button type="button" class="link-alt comment__header__context-menu__content-item" data-open="<%= "editCommentModal#{model.id}" %>" title="<%= t("decidim.components.comment.edit") %>" aria-controls="<%= "editCommentModal#{model.id}" %>" aria-haspopup="dialog" tabindex="0">
|
21
|
-
<%= icon "pencil", class: "icon--small", aria_label: t("decidim.components.comment.edit") %>
|
22
|
-
<span><%= t("decidim.components.comment.edit") %></span>
|
23
|
-
</button>
|
24
|
-
</li>
|
25
|
-
<li>
|
26
|
-
<%= link_to comment_path, remote: true, method: :delete, class: "comment__header__context-menu__content-item", data: { confirm: t("decidim.components.comment.confirm_destroy") } do %>
|
27
|
-
<%= icon "trash", class: "icon--small", aria_label: t("decidim.components.comment.delete") %>
|
28
|
-
<span><%= t("decidim.components.comment.delete") %></span>
|
29
|
-
<% end %>
|
30
|
-
</li>
|
31
|
-
<% end %>
|
32
|
-
</ul>
|
33
|
-
</div>
|
34
|
-
<% unless reloaded? %>
|
35
|
-
<% if current_user.present? %>
|
36
|
-
<%= cell("decidim/flag_modal", model, modal_id: "flagModalComment#{model.id}") %>
|
37
|
-
<% end %>
|
38
|
-
<% if model.authored_by?(current_user) %>
|
39
|
-
<%= cell("decidim/comments/edit_comment_modal_form", model, modal_id: "editCommentModal#{model.id}") %>
|
40
|
-
<% end %>
|
41
|
-
<% end %>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<div class="card__top">
|
2
|
-
<% if render_space? %>
|
3
|
-
<div class="card__content text-small">
|
4
|
-
<span class="muted"><%= searchable_resource_human_name(model.root_commentable.class, count: 1) %>:</span> <%= link_to root_commentable_title, resource_link_path, class: "card__link text-ellipsis" %>
|
5
|
-
</div>
|
6
|
-
<% end %>
|
7
|
-
</div>
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Comments
|
5
|
-
# This cell renders the Medium (:m) comment card
|
6
|
-
# for an given instance of a Comment
|
7
|
-
class CommentMCell < Decidim::CardMCell
|
8
|
-
include CommentCellsHelper
|
9
|
-
|
10
|
-
def statuses
|
11
|
-
[]
|
12
|
-
end
|
13
|
-
|
14
|
-
def comment
|
15
|
-
model
|
16
|
-
end
|
17
|
-
|
18
|
-
def has_header?
|
19
|
-
false
|
20
|
-
end
|
21
|
-
|
22
|
-
delegate :participatory_space, to: :model
|
23
|
-
|
24
|
-
def description
|
25
|
-
strip_tags(model.formatted_body).truncate(200, separator: /\s/)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|