decidim-comments 0.27.0 → 0.27.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/decidim/comments/comment.rb +6 -2
- data/app/packs/src/decidim/comments/comments.component.js +10 -4
- data/app/packs/src/decidim/comments/comments.component.test.js +15 -0
- data/config/locales/eu.yml +24 -19
- data/config/locales/gn-PY.yml +1 -0
- data/config/locales/ka-GE.yml +1 -0
- data/config/locales/lo-LA.yml +1 -0
- data/config/locales/pl.yml +4 -0
- data/config/locales/ro-RO.yml +2 -0
- data/config/locales/sv.yml +2 -0
- data/lib/decidim/comments/markdown.rb +12 -0
- data/lib/decidim/comments/version.rb +1 -1
- metadata +12 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c33bb43a97ef32ce38b5ee6db581b98f6128d146dfcbf1f44beb9d3a77650a29
|
4
|
+
data.tar.gz: 5ae194dd99009f8f73d1bbf6f037c24ab99367b770f18c07e4717b3defbdcd0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8be83a46d1b5e25a503dcbdc5008cdc66626ee308ab5e79f275ce8636520b69518db1168eb647f25313aca72d368a69f3430224d7a0d989e8ca894fb96beb98b
|
7
|
+
data.tar.gz: 9e3e0874809a1d523a1bfbdd34768997ae591bb82dda1b7f22dace5fd248d1cfea76630f52a861bd40d1e881ab19a2e8f43657753fe490e7911a7a045f0baa4e
|
@@ -56,8 +56,6 @@ module Decidim
|
|
56
56
|
validate :body_length
|
57
57
|
validate :commentable_can_have_comments
|
58
58
|
|
59
|
-
delegate :organization, to: :commentable
|
60
|
-
|
61
59
|
scope :not_deleted, -> { where(deleted_at: nil) }
|
62
60
|
|
63
61
|
translatable_fields :body
|
@@ -81,6 +79,10 @@ module Decidim
|
|
81
79
|
where(alignment: -1)
|
82
80
|
end
|
83
81
|
|
82
|
+
def organization
|
83
|
+
commentable&.organization || participatory_space&.organization
|
84
|
+
end
|
85
|
+
|
84
86
|
def visible?
|
85
87
|
participatory_space.try(:visible?) && component.try(:published?)
|
86
88
|
end
|
@@ -131,6 +133,8 @@ module Decidim
|
|
131
133
|
|
132
134
|
# Public: Overrides the `reported_content_url` Reportable concern method.
|
133
135
|
def reported_content_url
|
136
|
+
return unless root_commentable
|
137
|
+
|
134
138
|
url_params = { anchor: "comment_#{id}" }
|
135
139
|
|
136
140
|
if root_commentable.respond_to?(:polymorphic_resource_url)
|
@@ -43,7 +43,10 @@ export default class CommentsComponent {
|
|
43
43
|
this.mounted = true;
|
44
44
|
this._initializeComments(this.$element);
|
45
45
|
if (!this.singleComment) {
|
46
|
-
this.
|
46
|
+
$(".add-comment textarea", this.$element).prop("disabled", true);
|
47
|
+
this._fetchComments(() => {
|
48
|
+
$(".add-comment textarea", this.$element).prop("disabled", false);
|
49
|
+
});
|
47
50
|
}
|
48
51
|
|
49
52
|
$(".order-by__dropdown .is-submenu-item a", this.$element).on("click.decidim-comments", () => this._onInitOrder());
|
@@ -215,10 +218,11 @@ export default class CommentsComponent {
|
|
215
218
|
* Sends an ajax request based on current
|
216
219
|
* params to get comments for the component
|
217
220
|
* @private
|
221
|
+
* @param {Function} successCallback A callback that is called after a
|
222
|
+
* successful fetch
|
218
223
|
* @returns {Void} - Returns nothing
|
219
224
|
*/
|
220
|
-
_fetchComments() {
|
221
|
-
$(".add-comment textarea", this.$element).prop("disabled", true);
|
225
|
+
_fetchComments(successCallback = null) {
|
222
226
|
Rails.ajax({
|
223
227
|
url: this.commentsUrl,
|
224
228
|
type: "GET",
|
@@ -231,7 +235,9 @@ export default class CommentsComponent {
|
|
231
235
|
...(this.lastCommentId && { "after": this.lastCommentId })
|
232
236
|
}),
|
233
237
|
success: () => {
|
234
|
-
|
238
|
+
if (successCallback) {
|
239
|
+
successCallback();
|
240
|
+
}
|
235
241
|
this._pollComments();
|
236
242
|
}
|
237
243
|
});
|
@@ -418,6 +418,21 @@ describe("CommentsComponent", () => {
|
|
418
418
|
expect(window.setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 1000);
|
419
419
|
});
|
420
420
|
|
421
|
+
it("does not disable the textarea when polling comments normally", () => {
|
422
|
+
Rails.ajax.mockImplementationOnce((options) => options.success());
|
423
|
+
|
424
|
+
subject.mountComponent();
|
425
|
+
|
426
|
+
// Delay the success call 2s after the polling has happened to test that
|
427
|
+
// the textarea is still enabled when the polling is happening.
|
428
|
+
Rails.ajax.mockImplementationOnce((options) => {
|
429
|
+
setTimeout(options.success(), 2000);
|
430
|
+
});
|
431
|
+
jest.advanceTimersByTime(1500);
|
432
|
+
|
433
|
+
expect($(`${selector} .add-comment textarea`).prop("disabled")).toBeFalsy();
|
434
|
+
});
|
435
|
+
|
421
436
|
describe("when mounted", () => {
|
422
437
|
beforeEach(() => {
|
423
438
|
spyOnAddComment("on");
|
data/config/locales/eu.yml
CHANGED
@@ -4,14 +4,15 @@ eu:
|
|
4
4
|
models:
|
5
5
|
decidim/comments/comment_by_followed_user_event: Iruzkina
|
6
6
|
decidim/comments/comment_created_event: Iruzkina
|
7
|
+
decidim/comments/comment_upvoted_event: Iruzkina bozkatu da
|
7
8
|
decidim/comments/reply_created_event: Iruzkinaren erantzuna
|
8
|
-
decidim/comments/user_group_mentioned_event:
|
9
|
-
decidim/comments/user_mentioned_event:
|
9
|
+
decidim/comments/user_group_mentioned_event: Aipamena
|
10
|
+
decidim/comments/user_mentioned_event: Aipamena
|
10
11
|
activerecord:
|
11
12
|
models:
|
12
13
|
decidim/comments/comment:
|
13
14
|
one: Iruzkina
|
14
|
-
other:
|
15
|
+
other: Iruzkinak
|
15
16
|
decidim/comments/comment_vote:
|
16
17
|
one: Bozkatu
|
17
18
|
other: Botoak
|
@@ -21,7 +22,7 @@ eu:
|
|
21
22
|
shared:
|
22
23
|
availability_fields:
|
23
24
|
enabled: Iruzkinak gaituta
|
24
|
-
end_time: Iruzkinak
|
25
|
+
end_time: Iruzkinak gaituta daude
|
25
26
|
start_time: Iruzkinak noiztik aktibatuta
|
26
27
|
comments:
|
27
28
|
create:
|
@@ -37,7 +38,7 @@ eu:
|
|
37
38
|
view: Bistaratu
|
38
39
|
votes:
|
39
40
|
create:
|
40
|
-
error:
|
41
|
+
error: Arazo bat dago iruzkina bozkatzeko.
|
41
42
|
components:
|
42
43
|
add_comment_form:
|
43
44
|
account_message: <a href="%{sign_in_url}">Hasi saioa zure kontuarekin</a> o <a href="%{sign_up_url}">erregistratu</a> zure iruzkina txertatzeko.
|
@@ -67,10 +68,11 @@ eu:
|
|
67
68
|
confirm_destroy: Ziur zaude iruzkin hau ezabatu nahi duzula?
|
68
69
|
delete: Ezabatu
|
69
70
|
deleted_at: Iruzkina ezabatu da data honetan %{date}
|
70
|
-
deleted_user:
|
71
|
+
deleted_user: Parte hartzaile ezabatua
|
71
72
|
edit: Editatu
|
72
73
|
edited: Editatuta
|
73
74
|
hide_replies: Ezkutatu erantzunak
|
75
|
+
moderated_at: Iruzkina %{date}-an moderatu egin da
|
74
76
|
reply: Erantzuna
|
75
77
|
report:
|
76
78
|
action: Salatu
|
@@ -84,7 +86,7 @@ eu:
|
|
84
86
|
spam: Bertan badago clickbait-ik, publizitaterik edo iruzurrik.
|
85
87
|
title: Jakinarazi eduki desegokia
|
86
88
|
show_replies: Erakutsi %{replies_count} erantzun
|
87
|
-
single_comment_link_title: Lortu
|
89
|
+
single_comment_link_title: Lortu esteka
|
88
90
|
comment_order_selector:
|
89
91
|
order:
|
90
92
|
best_rated: Balorazio hoberenak
|
@@ -102,6 +104,9 @@ eu:
|
|
102
104
|
loading: Iruzkinak kargatzen...
|
103
105
|
single_comment_warning: <a href="%{url}">k erakusten ditu iruzkin guztiak</a>
|
104
106
|
single_comment_warning_title: Iruzkin bakar bat ikusten ari zara
|
107
|
+
title:
|
108
|
+
one: "%{count} iruzkin"
|
109
|
+
other: "%{count} iruzkin"
|
105
110
|
down_vote_button:
|
106
111
|
text: Ez nago ados iruzkin honekin
|
107
112
|
edit_comment_modal_form:
|
@@ -117,15 +122,15 @@ eu:
|
|
117
122
|
events:
|
118
123
|
comments:
|
119
124
|
comment_by_followed_user:
|
120
|
-
email_intro: "%{author_name} iruzkin bat utzi du %{resource_title}helbidean. Orri honetan irakur dezakezu:"
|
121
|
-
email_outro:
|
125
|
+
email_intro: "%{author_name} egileak iruzkin bat utzi du %{resource_title} helbidean. Orri honetan irakur dezakezu:"
|
126
|
+
email_outro: Jakinarazpen hau jaso duzu %{author_name} erabiltzailea jarraitzen duzulako. Erabiltzaile horri profil-orrialdetik ez jarraitu.
|
122
127
|
email_subject: '%{author_name} %{resource_title} iruzkin berri bat dago'
|
123
|
-
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a
|
128
|
+
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a>-en iruzkin berri bat dagon <a href="%{resource_path}">%{resource_title}</a>-an.
|
124
129
|
comment_by_followed_user_group:
|
125
130
|
email_intro: '%{author_name} k iruzkin bat utzi du hemen %{resource_title}. Orrialde honetan irakur dezakezu:'
|
126
131
|
email_outro: Jakinarazpena jaso duzu "%{author_name}" jarraitzen ari zarelako. Jarraitzeari utzi ahal diozu bere perfileko orrialdetik.
|
127
|
-
email_subject: '%{author_name}
|
128
|
-
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> <a href="%{resource_path}">%{resource_title}</a
|
132
|
+
email_subject: '%{author_name} egileak iruzkin berri bat utzi du %{resource_title}-an'
|
133
|
+
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a>egileak iruzkin berri bat utzi du <a href="%{resource_path}">%{resource_title}</a>-an.
|
129
134
|
comment_created:
|
130
135
|
email_intro: "%{resource_title} iruzkindu da. Orri honetan iruzkina irakur dezakezu:"
|
131
136
|
email_outro: Jakinarazpen hau jaso duzu "%{resource_title}" edo bere egilea jarraitzen duzulako. Aurreko esteka estekan jarrai dezakezu.
|
@@ -135,26 +140,26 @@ eu:
|
|
135
140
|
email_intro: Zure iruzkina hemen "%{resource_title}" negatiboki bozkatu da. Orain %{upvotes} boto positibo eta %{downvotes} boto negatibo dituzu guztira.
|
136
141
|
email_outro: Jakinarazpen hau jaso duzu iruzkin honen egilea zarelako.
|
137
142
|
email_subject: Zure iruzkina hemen "%{resource_title}" negatiboki bozkatu da.
|
138
|
-
notification_title: Zure
|
143
|
+
notification_title: Zure <a href="%{resource_path}">iruzkina</a> hemen "%{resource_title}" negatiboki bozkatu da. Orain guztira %{upvotes} boto positibo eta %{downvotes} boto negatibo dituzu.
|
139
144
|
comment_upvoted:
|
140
145
|
email_intro: Zure iruzkina hemen "%{resource_title}" positiboki bozkatu da. Orain guztira %{upvotes} boto positibo eta %{downvotes} boto negatibo dituzu.
|
141
146
|
email_outro: Jakinarazpen hau jaso duzu iruzkin honen egilea zarelako.
|
142
147
|
email_subject: Zure iruzkina hemen "%{resource_title}" positiboki bozkatu da.
|
143
|
-
notification_title: Zure
|
148
|
+
notification_title: Zure <a href="%{resource_path}">iruzkina </a> "%{resource_title}"-an positiboki bozkatu da. Orain guztira %{upvotes} botos positibo eta %{downvotes} boto negatibo dituzu.
|
144
149
|
reply_created:
|
145
150
|
email_intro: "%{author_name} zure iruzkina erantzun du %{resource_title}zenbakian. Orri honetan irakur dezakezu:"
|
146
151
|
email_outro: Jakinarazpen hau jaso duzu zure iruzkina erantzun delako.
|
147
|
-
email_subject: "%{author_name} zure iruzkina erantzun du %{resource_title} zenbakian"
|
152
|
+
email_subject: "%{author_name}-k zure iruzkina erantzun du %{resource_title} zenbakian"
|
148
153
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> -k zure iruzkinari erantzun dio <a href="%{resource_path}">%{resource_title}</a>
|
149
154
|
user_group_mentioned:
|
150
|
-
email_intro:
|
151
|
-
email_outro:
|
155
|
+
email_intro: Zure talde bat aipatu dute
|
156
|
+
email_outro: '%{resource_title}-an aipatutako %{group_name} taldeko kidea zarelako jaso duzu jakinarazpen hau.'
|
152
157
|
email_subject: Hemen %{resource_title} aipatu zaituzte %{group_name} taldearen kide gisa
|
153
158
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> k aipatu zaitu hemen <a href="%{resource_path}">%{resource_title}</a> <a href="%{group_path}">%{group_name} %{group_nickname}</a> taldearen kide gisa
|
154
159
|
user_mentioned:
|
155
|
-
email_intro:
|
160
|
+
email_intro: Aipatu zaituzte
|
156
161
|
email_outro: Jakinarazpena jaso duzu %{resource_title} delakoan aipatu duzulako.
|
157
|
-
email_subject: '%{resource_title} aipatu zaituzte'
|
162
|
+
email_subject: '%{resource_title} delakoan aipatu zaituzte'
|
158
163
|
notification_title: <a href="%{resource_path}">%{resource_title}</a> <a href="%{author_path}">%{author_name} %{author_nickname}</a> bidez aipatu zaituzte.
|
159
164
|
metrics:
|
160
165
|
comments:
|
@@ -0,0 +1 @@
|
|
1
|
+
gn:
|
@@ -0,0 +1 @@
|
|
1
|
+
ka:
|
@@ -0,0 +1 @@
|
|
1
|
+
lo:
|
data/config/locales/pl.yml
CHANGED
data/config/locales/ro-RO.yml
CHANGED
@@ -4,6 +4,7 @@ ro:
|
|
4
4
|
models:
|
5
5
|
decidim/comments/comment_by_followed_user_event: Comentariu
|
6
6
|
decidim/comments/comment_created_event: Comentează
|
7
|
+
decidim/comments/comment_upvoted_event: Comentariu votat
|
7
8
|
decidim/comments/reply_created_event: Răspuns la comentariu
|
8
9
|
decidim/comments/user_group_mentioned_event: Menționează
|
9
10
|
decidim/comments/user_mentioned_event: Menționează
|
@@ -73,6 +74,7 @@ ro:
|
|
73
74
|
edit: Editează
|
74
75
|
edited: Editat
|
75
76
|
hide_replies: Ascunde răspunsurile
|
77
|
+
moderated_at: Comentariu moderat pe %{date}
|
76
78
|
reply: Răspunde
|
77
79
|
report:
|
78
80
|
action: Raportează
|
data/config/locales/sv.yml
CHANGED
@@ -4,6 +4,7 @@ sv:
|
|
4
4
|
models:
|
5
5
|
decidim/comments/comment_by_followed_user_event: Kommentar
|
6
6
|
decidim/comments/comment_created_event: Kommentar
|
7
|
+
decidim/comments/comment_upvoted_event: Kommentar uppröstad
|
7
8
|
decidim/comments/reply_created_event: Svar till en kommentar
|
8
9
|
decidim/comments/user_group_mentioned_event: Nämn
|
9
10
|
decidim/comments/user_mentioned_event: Nämn
|
@@ -71,6 +72,7 @@ sv:
|
|
71
72
|
edit: Redigera
|
72
73
|
edited: Redigerad
|
73
74
|
hide_replies: Göm svar
|
75
|
+
moderated_at: Kommentar modererad den %{date}
|
74
76
|
reply: Svara
|
75
77
|
report:
|
76
78
|
action: Rapportera
|
@@ -50,6 +50,18 @@ module Decidim
|
|
50
50
|
|
51
51
|
"<p>#{text}</p>"
|
52
52
|
end
|
53
|
+
|
54
|
+
# Prevents underscores to be replaced with <em> tags in comments, such as
|
55
|
+
# https://github.com/org/module_with_underscores or within words such as
|
56
|
+
# "Look for comment_maximum_length in the code". The `no_intra_emphasis`
|
57
|
+
# option for Redcarpet does not apparently work for this renderer.
|
58
|
+
#
|
59
|
+
# Related issues:
|
60
|
+
# https://github.com/vmg/redcarpet/issues/402
|
61
|
+
# https://github.com/vmg/redcarpet/issues/427
|
62
|
+
def emphasis(text)
|
63
|
+
"_#{text}_"
|
64
|
+
end
|
53
65
|
end
|
54
66
|
end
|
55
67
|
end
|
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.27.
|
4
|
+
version: 0.27.2
|
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:
|
13
|
+
date: 2023-02-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.27.
|
21
|
+
version: 0.27.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.27.
|
28
|
+
version: 0.27.2
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: redcarpet
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,28 +52,28 @@ dependencies:
|
|
52
52
|
requirements:
|
53
53
|
- - '='
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.27.
|
55
|
+
version: 0.27.2
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
58
|
version_requirements: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - '='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.27.
|
62
|
+
version: 0.27.2
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: decidim-dev
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - '='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.27.
|
69
|
+
version: 0.27.2
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - '='
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.27.
|
76
|
+
version: 0.27.2
|
77
77
|
description: Pluggable comments system for some components.
|
78
78
|
email:
|
79
79
|
- josepjaume@gmail.com
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- config/locales/fr.yml
|
198
198
|
- config/locales/ga-IE.yml
|
199
199
|
- config/locales/gl.yml
|
200
|
+
- config/locales/gn-PY.yml
|
200
201
|
- config/locales/hr-HR.yml
|
201
202
|
- config/locales/hr.yml
|
202
203
|
- config/locales/hu.yml
|
@@ -205,10 +206,12 @@ files:
|
|
205
206
|
- config/locales/is.yml
|
206
207
|
- config/locales/it.yml
|
207
208
|
- config/locales/ja.yml
|
209
|
+
- config/locales/ka-GE.yml
|
208
210
|
- config/locales/ko-KR.yml
|
209
211
|
- config/locales/ko.yml
|
210
212
|
- config/locales/lb-LU.yml
|
211
213
|
- config/locales/lb.yml
|
214
|
+
- config/locales/lo-LA.yml
|
212
215
|
- config/locales/lt-LT.yml
|
213
216
|
- config/locales/lt.yml
|
214
217
|
- config/locales/lv.yml
|
@@ -305,7 +308,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
308
|
- !ruby/object:Gem::Version
|
306
309
|
version: '0'
|
307
310
|
requirements: []
|
308
|
-
rubygems_version: 3.
|
311
|
+
rubygems_version: 3.3.7
|
309
312
|
signing_key:
|
310
313
|
specification_version: 4
|
311
314
|
summary: Decidim comments module
|