decidim-comments 0.32.1 → 0.32.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/cells/decidim/comments/comment_form/show.erb +5 -1
- data/app/cells/decidim/comments/edit_comment_modal_form/show.erb +5 -1
- data/app/controllers/decidim/comments/application_controller.rb +2 -0
- data/app/controllers/decidim/comments/comments_controller.rb +7 -3
- data/app/controllers/decidim/comments/votes_controller.rb +3 -1
- data/app/models/decidim/comments/comment.rb +8 -0
- data/app/packs/src/decidim/comments/comments.component.js +1 -1
- data/app/packs/src/decidim/comments/comments.component.test.js +6 -0
- data/app/packs/stylesheets/comments.scss +0 -2
- data/config/locales/ca.yml +3 -3
- data/config/locales/de.yml +4 -0
- data/config/locales/eu.yml +9 -9
- data/config/locales/fr-CA.yml +1 -0
- data/config/locales/fr.yml +1 -0
- data/config/locales/gl.yml +80 -3
- data/config/locales/sk.yml +4 -0
- data/config/locales/sv.yml +9 -3
- data/decidim-comments.gemspec +1 -1
- data/lib/decidim/comments/mutation_extensions.rb +12 -0
- data/lib/decidim/comments/query_extensions.rb +9 -0
- data/{app/models → lib}/decidim/comments/seed.rb +9 -3
- data/lib/decidim/comments/version.rb +1 -1
- data/lib/decidim/comments.rb +1 -0
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f7047fc91db47a33c578eb418293109690463145e6489bfb4905f41675328d5
|
|
4
|
+
data.tar.gz: 47a7f23562c90b50ffd7a58b908ed92a3a837f03ce66bec55e1a0388fad7df77
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8f2a232c09dd855515be00b9244e94b488693df1290132d012a0cf99ee2ee9c9e884e24723c43e736bbc4b7f97c6a620bc47386a6c1056531cbf2d29eba3101
|
|
7
|
+
data.tar.gz: 171c16f53238eafa5f1b3ccc73e0eff270ce4d2bdd06ed2ac32178f79a7f17de5339527ea73a8837a72fd569a903458d5f528c82ca8254864a886dbb94cbba77
|
|
@@ -20,7 +20,11 @@
|
|
|
20
20
|
required: true,
|
|
21
21
|
placeholder: t("decidim.components.add_comment_form.form.body.placeholder"),
|
|
22
22
|
label: false,
|
|
23
|
-
data: {
|
|
23
|
+
data: {
|
|
24
|
+
remaining_characters: "##{add_comment_id}-remaining-characters",
|
|
25
|
+
controller: "emoji mention character-counter",
|
|
26
|
+
search_prompt: t("decidim.shared.mentions.search_prompt")
|
|
27
|
+
}
|
|
24
28
|
) %>
|
|
25
29
|
</div>
|
|
26
30
|
<span id="<%= add_comment_id %>-remaining-characters" class="remaining-character-count"></span>
|
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
placeholder: t("decidim.components.edit_comment_modal_form.form.body.placeholder"),
|
|
20
20
|
label: false,
|
|
21
21
|
class: "w-full rounded border min-h-[160px] border-text-gray-2",
|
|
22
|
-
data: {
|
|
22
|
+
data: {
|
|
23
|
+
remaining_characters: "##{form_id}-remaining-characters",
|
|
24
|
+
controller: "emoji mention character-counter",
|
|
25
|
+
search_prompt: t("decidim.shared.mentions.search_prompt")
|
|
26
|
+
}
|
|
23
27
|
) %>
|
|
24
28
|
</div>
|
|
25
29
|
</div>
|
|
@@ -13,7 +13,7 @@ module Decidim
|
|
|
13
13
|
before_action :set_commentable, except: [:destroy, :update]
|
|
14
14
|
before_action :ensure_commentable!, except: [:destroy, :update]
|
|
15
15
|
|
|
16
|
-
helper_method :root_depth, :commentable, :order, :reply?, :reload?, :root_comment, :load_more?, :comments_offset, :alignment
|
|
16
|
+
helper_method :root_depth, :commentable, :order, :reply?, :reload?, :root_comment, :load_more?, :comments_offset, :alignment, :current_component
|
|
17
17
|
|
|
18
18
|
def index
|
|
19
19
|
enforce_permission_to(:read, :comment, commentable:)
|
|
@@ -144,14 +144,18 @@ module Decidim
|
|
|
144
144
|
|
|
145
145
|
def set_commentable
|
|
146
146
|
@commentable ||= if commentable_gid
|
|
147
|
-
GlobalID::Locator.locate_signed(commentable_gid)
|
|
147
|
+
resource = GlobalID::Locator.locate_signed(commentable_gid)
|
|
148
|
+
ensure_in_organization!(resource)
|
|
149
|
+
resource
|
|
148
150
|
elsif comment
|
|
149
151
|
comment.root_commentable
|
|
150
152
|
end
|
|
151
153
|
end
|
|
152
154
|
|
|
153
155
|
def set_comment
|
|
154
|
-
@comment = Decidim::Comments::Comment
|
|
156
|
+
@comment = Decidim::Comments::Comment
|
|
157
|
+
.for_organization(organization: current_organization)
|
|
158
|
+
.find(params.expect(:id))
|
|
155
159
|
end
|
|
156
160
|
|
|
157
161
|
def ensure_commentable!
|
|
@@ -34,7 +34,9 @@ module Decidim
|
|
|
34
34
|
attr_reader :comment
|
|
35
35
|
|
|
36
36
|
def set_comment
|
|
37
|
-
@comment = Decidim::Comments::Comment
|
|
37
|
+
@comment = Decidim::Comments::Comment
|
|
38
|
+
.for_organization(organization: current_organization)
|
|
39
|
+
.find(params.expect(:comment_id))
|
|
38
40
|
end
|
|
39
41
|
end
|
|
40
42
|
end
|
|
@@ -59,6 +59,14 @@ module Decidim
|
|
|
59
59
|
|
|
60
60
|
scope :not_deleted, -> { where(deleted_at: nil) }
|
|
61
61
|
|
|
62
|
+
# Scopes comments to the participatory spaces owned by the organization.
|
|
63
|
+
# Comments on resources store their participatory space, while comments
|
|
64
|
+
# on participatory spaces use the space itself as the root commentable.
|
|
65
|
+
def self.for_organization(organization:)
|
|
66
|
+
spaces = organization.participatory_spaces
|
|
67
|
+
where(participatory_space: spaces).or(where(root_commentable: spaces))
|
|
68
|
+
end
|
|
69
|
+
|
|
62
70
|
translatable_fields :body
|
|
63
71
|
searchable_fields({
|
|
64
72
|
participatory_space: :itself,
|
|
@@ -136,7 +136,7 @@ export default class CommentsComponent {
|
|
|
136
136
|
* @returns {String} - Returns a unique identifier
|
|
137
137
|
*/
|
|
138
138
|
_getUID() {
|
|
139
|
-
return `comments-${new Date().
|
|
139
|
+
return `comments-${new Date().getUTCMilliseconds()}-${Math.floor(Math.random() * 10000000)}`;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
@@ -403,6 +403,12 @@ describe("CommentsComponent", () => {
|
|
|
403
403
|
expect(CommentsComponent).toBeDefined();
|
|
404
404
|
});
|
|
405
405
|
|
|
406
|
+
it("generates an ID if not defined", () => {
|
|
407
|
+
const dummyElement = document.createElement("div");
|
|
408
|
+
const component = new CommentsComponent($(dummyElement), {});
|
|
409
|
+
expect(component.id).toMatch(/^comments-\d{1,3}-\d+$/);
|
|
410
|
+
});
|
|
411
|
+
|
|
406
412
|
it("initializes unmounted", () => {
|
|
407
413
|
expect(subject.mounted).toBeFalsy();
|
|
408
414
|
});
|
data/config/locales/ca.yml
CHANGED
|
@@ -169,12 +169,12 @@ ca:
|
|
|
169
169
|
email_intro: "%{author_name} ha deixat un comentari a %{resource_title}. Podeu llegir-lo en aquesta pàgina:"
|
|
170
170
|
email_outro: Has rebut aquesta notificació perquè estàs seguint el comentari "%{author_name}". Pots deixar de seguir a aquesta participant des de la seva pàgina de perfil.
|
|
171
171
|
email_subject: Hi ha un nou comentari de %{author_name} en %{resource_title}
|
|
172
|
-
notification_title: Hi ha un nou comentari de <a href="%{author_path}">%{author_name}</a> a<a href="%{resource_path}">%{resource_title}</a>.
|
|
172
|
+
notification_title: Hi ha un nou comentari de <a href="%{author_path}">%{author_name}</a> a <a href="%{resource_path}">%{resource_title}</a>.
|
|
173
173
|
comment_created:
|
|
174
174
|
email_intro: "Algú ha deixat un comentari a \"%{resource_title}\". Pots llegir el comentari a través del següent enllaç:"
|
|
175
175
|
email_outro: Has rebut aquesta notificació perquè estàs seguint el comentari "%{resource_title}" o la seva autora. Pots deixar de seguir-la des de l'enllaç anterior.
|
|
176
176
|
email_subject: Hi ha un nou comentari de %{author_name} a %{resource_title}
|
|
177
|
-
notification_title: Hi ha un nou comentari de <a href="%{author_path}">%{author_name}</a> a<a href="%{resource_path}">%{resource_title}</a>
|
|
177
|
+
notification_title: Hi ha un nou comentari de <a href="%{author_path}">%{author_name}</a> a <a href="%{resource_path}">%{resource_title}</a>
|
|
178
178
|
comment_downvoted:
|
|
179
179
|
email_intro: El teu comentari a "%{resource_title}" ha rebut un vot negatiu. Ara té un total de %{upvotes} vots positius i %{downvotes} vots negatius.
|
|
180
180
|
email_outro: Has rebut aquesta notificació perquè vas fer aquest comentari.
|
|
@@ -194,7 +194,7 @@ ca:
|
|
|
194
194
|
email_intro: Has estat esmentada
|
|
195
195
|
email_outro: Has rebut aquesta notificació perquè t'han esmentat al comentari "%{resource_title}".
|
|
196
196
|
email_subject: Has estat esmentada a %{resource_title}
|
|
197
|
-
notification_title:
|
|
197
|
+
notification_title: <a href="%{author_path}">%{author_name}</a> t'ha esmentat a <a href="%{resource_path}">%{resource_title}</a>
|
|
198
198
|
errors:
|
|
199
199
|
messages:
|
|
200
200
|
cannot_have_comments: no es poden fer comentaris
|
data/config/locales/de.yml
CHANGED
|
@@ -169,10 +169,12 @@ de:
|
|
|
169
169
|
email_intro: "%{author_name} hat einen Kommentar zu %{resource_title} hinterlassen. Sie können diesen auf dieser Seite lesen:"
|
|
170
170
|
email_outro: Sie haben diese Benachrichtigung erhalten, weil Sie %{author_name} folgen. Falls Sie keine solchen Benachrichtigungen mehr erhalten möchten, besuchen Sie die Profil-Seite dieses Benutzers.
|
|
171
171
|
email_subject: Neuer Kommentar von %{author_name} zu %{resource_title}
|
|
172
|
+
notification_title: Es gibt einen neuen Kommentar von <a href="%{author_path}">%{author_name}</a> zu <a href="%{resource_path}">%{resource_title}</a>.
|
|
172
173
|
comment_created:
|
|
173
174
|
email_intro: "%{resource_title} wurde kommentiert. Sie können den Kommentar auf dieser Seite lesen:"
|
|
174
175
|
email_outro: Sie haben diese Benachrichtigung erhalten, weil Sie "%{resource_title}" oder seinem Autor folgen. Falls Sie keine solchen Benachrichtigungen mehr erhalten möchten, besuchen Sie den obigen Link.
|
|
175
176
|
email_subject: Neuer Kommentar von %{author_name} zu %{resource_title}
|
|
177
|
+
notification_title: Es gibt einen neuen Kommentar von <a href="%{author_path}">%{author_name}</a> zu <a href="%{resource_path}">%{resource_title}</a>
|
|
176
178
|
comment_downvoted:
|
|
177
179
|
email_intro: Ihr Kommentar in "%{resource_title}" wurde negativ bewertet. Er hat nun insgesamt %{upvotes} positive und %{downvotes} negative Stimmen.
|
|
178
180
|
email_outro: Sie haben diese Benachrichtigung erhalten, weil Sie der Autor des Vorschlags sind.
|
|
@@ -187,10 +189,12 @@ de:
|
|
|
187
189
|
email_intro: "%{author_name} hat auf Ihren Kommentar zu %{resource_title} geantwortet. Sie können das auf dieser Seite lesen:"
|
|
188
190
|
email_outro: Sie haben diese Benachrichtigung erhalten, weil Ihr Kommentar beantwortet wurde.
|
|
189
191
|
email_subject: "%{author_name} hat auf Ihren Kommentar zu %{resource_title} geantwortet"
|
|
192
|
+
notification_title: <a href="%{author_path}">%{author_name}</a> hat auf Ihren Kommentar zu <a href="%{resource_path}">%{resource_title}</a> geantwortet
|
|
190
193
|
user_mentioned:
|
|
191
194
|
email_intro: Sie wurden erwähnt
|
|
192
195
|
email_outro: Sie haben diese Benachrichtigung erhalten, weil Sie in %{resource_title} erwähnt wurden.
|
|
193
196
|
email_subject: Sie wurden in %{resource_title} erwähnt
|
|
197
|
+
notification_title: Sie wurden von <a href="%{author_path}">%{author_name}</a> in <a href="%{resource_path}">%{resource_title}</a> erwähnt
|
|
194
198
|
errors:
|
|
195
199
|
messages:
|
|
196
200
|
cannot_have_comments: kann keine Kommentare haben
|
data/config/locales/eu.yml
CHANGED
|
@@ -61,8 +61,8 @@ eu:
|
|
|
61
61
|
neutral_selected: Zure iritzia gai honi buruz neutroa da
|
|
62
62
|
positive: Positiboa
|
|
63
63
|
positive_selected: Zure iritzia gai honi buruz positiboa da
|
|
64
|
-
remaining_characters: "%{count}
|
|
65
|
-
remaining_characters_1: "%{count}
|
|
64
|
+
remaining_characters: "Karaktere %{count} geratzen da"
|
|
65
|
+
remaining_characters_1: "%{count} karaktere geratzen dira"
|
|
66
66
|
title: Gehitu zure iruzkina
|
|
67
67
|
comment:
|
|
68
68
|
alignment:
|
|
@@ -97,11 +97,11 @@ eu:
|
|
|
97
97
|
does_not_belong: Bertan badago legez kontrako jardunik, suizidio-mehatxurik, informazio pertsonalik edo beste zernahi, zure ustez %{organization_name}-ri ez dagokionik.
|
|
98
98
|
offensive: Arrazakeria, sexismoa, laidoak, eraso pertsonalak, heriotza-mehatxuak, suizidio eskaerak edo gorrotozko edozein diskurtso.
|
|
99
99
|
spam: Bertan badago clickbait-ik, publizitaterik edo iruzurrik.
|
|
100
|
-
title:
|
|
100
|
+
title: Eduki desegokia salatu
|
|
101
101
|
show_replies:
|
|
102
|
-
one: Erakutsi %{count}
|
|
102
|
+
one: Erakutsi erantzun %{count}
|
|
103
103
|
other: Erakutsi %{count} erantzun
|
|
104
|
-
single_comment_link_title:
|
|
104
|
+
single_comment_link_title: Esteka lortu
|
|
105
105
|
sort_by: 'Nork sortua:'
|
|
106
106
|
comment_order_selector:
|
|
107
107
|
order:
|
|
@@ -123,7 +123,7 @@ eu:
|
|
|
123
123
|
single_comment_warning: <a href="%{url}"> iruzkin guztiak ikusgai </a>
|
|
124
124
|
single_comment_warning_title: Iruzkin bakar bat ikusten ari zara
|
|
125
125
|
title:
|
|
126
|
-
one: "Iruzkin
|
|
126
|
+
one: "Iruzkin %{count}"
|
|
127
127
|
other: "%{count} iruzkin"
|
|
128
128
|
top_comment_label: Babes gehien galdu dituztenak
|
|
129
129
|
down_vote_button:
|
|
@@ -148,9 +148,9 @@ eu:
|
|
|
148
148
|
help:
|
|
149
149
|
comment_votes:
|
|
150
150
|
comment: Bozkatutako iruzkinaren identifikazioa
|
|
151
|
-
created_at: Zein datatan sortu
|
|
151
|
+
created_at: Zein datatan sortu den bozketa hau
|
|
152
152
|
id: Babesaren identifikazioa
|
|
153
|
-
updated_at: Zein datatan eguneratu
|
|
153
|
+
updated_at: Zein datatan eguneratu den azken aldiz bozketa hau
|
|
154
154
|
weight: Babesaren balioa (1 boto gehiago, -1 boto gutxiago)
|
|
155
155
|
comments:
|
|
156
156
|
alignment: Iruzkin hau aldekoa bazen, kontrakoa edo neutrala
|
|
@@ -158,7 +158,7 @@ eu:
|
|
|
158
158
|
body: Iruzkina bera
|
|
159
159
|
commentable_id: Iruzkingarriaren identifikazio bakarra
|
|
160
160
|
commentable_type: Iruzkingarri mota (emaitza, proposamena... bazen)
|
|
161
|
-
created_at: Zein datatan sortu
|
|
161
|
+
created_at: Zein datatan sortu den iruzkin hau
|
|
162
162
|
depth: Zein lekutan dago iruzkin hau hiru iruzkinetan (iruzkinaren erantzuna bada edo erantzunaren erantzuna bada)
|
|
163
163
|
id: Identifikazioa iruzkin honetarako
|
|
164
164
|
locale: Parte-hartzaileak iruzkin hau uztean erabili du tokiko hizkuntza
|
data/config/locales/fr-CA.yml
CHANGED
|
@@ -146,6 +146,7 @@ fr-CA:
|
|
|
146
146
|
comment_votes:
|
|
147
147
|
id: L'id du vote
|
|
148
148
|
comments:
|
|
149
|
+
author: Le nom du participant qui a laissé ce commentaire
|
|
149
150
|
body: Le commentaire lui-même
|
|
150
151
|
commentable_id: L'identifiant unique de l"élément commenté
|
|
151
152
|
commentable_type: Le type de l'élément commenté (si c'était un résultat, une proposition, etc.)
|
data/config/locales/fr.yml
CHANGED
|
@@ -146,6 +146,7 @@ fr:
|
|
|
146
146
|
comment_votes:
|
|
147
147
|
id: L'id du vote
|
|
148
148
|
comments:
|
|
149
|
+
author: Le nom du participant qui a laissé ce commentaire
|
|
149
150
|
body: Le commentaire lui-même
|
|
150
151
|
commentable_id: L'identifiant unique de l"élément commenté
|
|
151
152
|
commentable_type: Le type de l'élément commenté (si c'était un résultat, une proposition, etc.)
|
data/config/locales/gl.yml
CHANGED
|
@@ -4,6 +4,7 @@ gl:
|
|
|
4
4
|
models:
|
|
5
5
|
decidim/comments/comment_by_followed_user_event: Comentario
|
|
6
6
|
decidim/comments/comment_created_event: Comentario
|
|
7
|
+
decidim/comments/comment_upvoted_event: Comentario valorado positivamente
|
|
7
8
|
decidim/comments/reply_created_event: Comentario de resposta
|
|
8
9
|
decidim/comments/user_mentioned_event: Mención
|
|
9
10
|
activerecord:
|
|
@@ -13,7 +14,7 @@ gl:
|
|
|
13
14
|
other: Comentarios
|
|
14
15
|
decidim/comments/comment_vote:
|
|
15
16
|
one: Vota
|
|
16
|
-
other:
|
|
17
|
+
other: Apoios
|
|
17
18
|
decidim:
|
|
18
19
|
admin:
|
|
19
20
|
admin_log:
|
|
@@ -26,20 +27,32 @@ gl:
|
|
|
26
27
|
enabled: Comentarios habilitados
|
|
27
28
|
end_time: Comentarios habilitados até
|
|
28
29
|
start_time: Comentarios habilitados dende
|
|
30
|
+
comment_thread:
|
|
31
|
+
accessibility_label: Fío de comentarios iniciado por %{full_name} o %{date}
|
|
29
32
|
comments:
|
|
30
33
|
create:
|
|
31
34
|
error: Produciuse un problema ao crear o comentario.
|
|
35
|
+
delete:
|
|
36
|
+
error: Non se puido eliminar o comentario.
|
|
32
37
|
update:
|
|
33
38
|
error: Produciuse un problema ao actualizar o comentario.
|
|
39
|
+
comments_title: Comentar
|
|
40
|
+
last_activity:
|
|
41
|
+
new_comment: 'Novo comentario:'
|
|
34
42
|
votes:
|
|
35
43
|
create:
|
|
36
|
-
error: Houbo erros ao
|
|
44
|
+
error: Houbo erros ao apoiar o comentario.
|
|
37
45
|
components:
|
|
38
46
|
add_comment_form:
|
|
47
|
+
account_message: Inicia sesión ou crea unha conta para engadir o teu comentario.
|
|
48
|
+
add_comment: Engadir comentario
|
|
39
49
|
form:
|
|
40
50
|
body:
|
|
41
51
|
label: Comentario
|
|
42
52
|
placeholder: Que vos parece?
|
|
53
|
+
form_error: O texto é obrigatorio e non pode superar os %{length} caracteres.
|
|
54
|
+
submit_reply: Publicar resposta
|
|
55
|
+
submit_root_comment: Publicar comentario
|
|
43
56
|
opinion:
|
|
44
57
|
label: A túa opinión canto a este tema
|
|
45
58
|
negative: Negativa
|
|
@@ -55,13 +68,24 @@ gl:
|
|
|
55
68
|
alignment:
|
|
56
69
|
against: Contra
|
|
57
70
|
in_favor: A favor
|
|
71
|
+
cancel_reply: Cancelar resposta
|
|
72
|
+
comment_label: Comentario %{comment_id}
|
|
73
|
+
comment_label_reply: Comentario %{comment_id} (resposta ao comentario %{parent_comment_id})
|
|
58
74
|
confirm_destroy: Estás certo/a de querer eliminar este comentario?
|
|
75
|
+
controls_label: Controis do comentario
|
|
59
76
|
delete: Eliminar
|
|
60
77
|
deleted_at: Comentario eliminado o %{date}
|
|
61
78
|
deleted_user: Usuario eliminado
|
|
62
79
|
edit: Editar
|
|
63
80
|
edited: Editado
|
|
81
|
+
hide_replies:
|
|
82
|
+
one: Ocultar resposta
|
|
83
|
+
other: Ocultar %{count} respostas
|
|
84
|
+
load_replies: Cargar respostas
|
|
64
85
|
moderated_at: Comentario moderado o %{date}
|
|
86
|
+
replies_count:
|
|
87
|
+
one: "%{count} resposta"
|
|
88
|
+
other: "%{count} respostas"
|
|
65
89
|
reply: Responder
|
|
66
90
|
report:
|
|
67
91
|
action: Informe
|
|
@@ -70,10 +94,15 @@ gl:
|
|
|
70
94
|
description: Este contido é inapropiado?
|
|
71
95
|
details: Comentarios adicionais
|
|
72
96
|
reasons:
|
|
97
|
+
does_not_belong: Contén actividade ilegal, ameazas de suicidio, información persoal ou outro contido que consideras que non debería estar en %{organization_name}.
|
|
73
98
|
offensive: Contén racismo, sexismo, abuso, ataques persoais, ameazas de morte, solicitudes de suicidio ou calquera tipo de discurso de odio.
|
|
74
99
|
spam: Contén clic, publicidade, fraudes ou bots de script.
|
|
75
100
|
title: Denunciar contido inapropiado
|
|
101
|
+
show_replies:
|
|
102
|
+
one: Mostrar resposta
|
|
103
|
+
other: Mostrar %{count} respostas
|
|
76
104
|
single_comment_link_title: Obter ligazón
|
|
105
|
+
sort_by: 'Ordenar por: '
|
|
77
106
|
comment_order_selector:
|
|
78
107
|
order:
|
|
79
108
|
best_rated: Mellor valorado
|
|
@@ -82,16 +111,25 @@ gl:
|
|
|
82
111
|
recent: Recentes
|
|
83
112
|
title: 'Ordenar por:'
|
|
84
113
|
comments:
|
|
114
|
+
against: En contra
|
|
85
115
|
blocked_comments_for_unauthorized_user_warning: Tes de estar verificado para poder comentar neste intre, porén podes ler os comentarios anteriores.
|
|
86
116
|
blocked_comments_for_user_warning: Non podes comentar neste momento, pero podes ler os anteriores.
|
|
117
|
+
blocked_comments_warning: Os comentarios están desactivados neste momento; só as persoas administradoras poden responder ou publicar novos comentarios.
|
|
87
118
|
comment_details_title: Detalles do comentario
|
|
119
|
+
in_favor: A favor
|
|
120
|
+
load_more_comments: Cargar máis comentarios
|
|
88
121
|
loading: Cargando comentarios ...
|
|
122
|
+
no_comments_yet: Aínda non hai comentarios
|
|
89
123
|
single_comment_warning: <a href="%{url}">Ver todos os comentarios</a>
|
|
90
124
|
single_comment_warning_title: Estás a ver un único comentario
|
|
91
125
|
title:
|
|
92
126
|
one: "%{count} comentario"
|
|
93
127
|
other: "%{count} comentarios"
|
|
128
|
+
top_comment_label: Mellor valorado
|
|
94
129
|
down_vote_button:
|
|
130
|
+
label:
|
|
131
|
+
one: Botón «Non me gusta». %{count} valoración negativa
|
|
132
|
+
other: Botón «Non me gusta». %{count} valoracións negativas
|
|
95
133
|
text: Non estou de acordo con este comentario
|
|
96
134
|
edit_comment_modal_form:
|
|
97
135
|
close: Pechar
|
|
@@ -102,22 +140,61 @@ gl:
|
|
|
102
140
|
submit: Enviar
|
|
103
141
|
title: Editar o teu comentario
|
|
104
142
|
up_vote_button:
|
|
143
|
+
label:
|
|
144
|
+
one: Botón «Gústame». %{count} valoración positiva
|
|
145
|
+
other: Botón «Gústame». %{count} valoracións positivas
|
|
105
146
|
text: Estou de acordo con este comentario
|
|
147
|
+
download_your_data:
|
|
148
|
+
help:
|
|
149
|
+
comment_votes:
|
|
150
|
+
comment: O identificador do comentario que se valorou
|
|
151
|
+
created_at: A data na que se creou esta valoración
|
|
152
|
+
id: O identificador da valoración
|
|
153
|
+
updated_at: A data da última actualización desta valoración
|
|
154
|
+
weight: O peso da valoración (1 para positiva e -1 para negativa)
|
|
155
|
+
comments:
|
|
156
|
+
alignment: Se este comentario foi a favor, en contra ou neutral
|
|
157
|
+
author: O nome da persoa participante que fixo este comentario
|
|
158
|
+
body: O propio comentario
|
|
159
|
+
commentable_id: O identificador único do recurso comentable
|
|
160
|
+
commentable_type: O tipo de recurso comentable (se era un resultado, unha proposta etc.)
|
|
161
|
+
created_at: A data na que se creou este comentario
|
|
162
|
+
depth: A posición deste comentario na árbore de comentarios (se é unha resposta ou unha resposta a outra resposta)
|
|
163
|
+
id: O identificador deste comentario
|
|
164
|
+
locale: A configuración rexional (idioma) da persoa participante cando deixou este comentario
|
|
165
|
+
root_commentable_url: O URL do recurso ao que está vinculado este comentario
|
|
106
166
|
events:
|
|
107
167
|
comments:
|
|
108
168
|
comment_by_followed_user:
|
|
109
169
|
email_intro: "%{author_name} deixou un comentario en %{resource_title}. Podes lelo nesta páxina:"
|
|
110
|
-
email_outro: Recibiches esta notificación porque estás seguindo %{author_name}. Podes deixar de seguir este
|
|
170
|
+
email_outro: Recibiches esta notificación porque estás seguindo %{author_name}. Podes deixar de seguir este participante desde a súa páxina de perfil.
|
|
111
171
|
email_subject: Hai un novo comentario por %{author_name} en %{resource_title}
|
|
172
|
+
notification_title: Hai un novo comentario de <a href="%{author_path}">%{author_name}</a> en <a href="%{resource_path}">%{resource_title}</a>.
|
|
112
173
|
comment_created:
|
|
113
174
|
email_intro: "Comentouse %{resource_title} . Podes ler o comentario nesta páxina:"
|
|
114
175
|
email_outro: Recibiches esta notificación porque estás seguindo "%{resource_title}" ou o seu autor. Podes deixar de seguir desde a ligazón anterior.
|
|
115
176
|
email_subject: Hai un novo comentario de %{author_name} en %{resource_title}
|
|
177
|
+
notification_title: Hai un novo comentario de <a href="%{author_path}">%{author_name}</a> en <a href="%{resource_path}">%{resource_title}</a>
|
|
178
|
+
comment_downvoted:
|
|
179
|
+
email_intro: O teu comentario en «%{resource_title}» recibiu unha valoración negativa. Agora ten un total de %{upvotes} valoracións positivas e %{downvotes} negativas.
|
|
180
|
+
email_outro: Recibiches esta notificación porque es a persoa autora deste comentario.
|
|
181
|
+
email_subject: O teu comentario en «%{resource_title}» recibiu unha valoración negativa.
|
|
182
|
+
notification_title: O teu <a href="%{resource_path}">comentario</a> en «%{resource_title}» recibiu unha valoración negativa. Agora ten un total de %{upvotes} valoracións positivas e %{downvotes} negativas.
|
|
183
|
+
comment_upvoted:
|
|
184
|
+
email_intro: O teu comentario en «%{resource_title}» recibiu unha valoración positiva. Agora ten un total de %{upvotes} valoracións positivas e %{downvotes} negativas.
|
|
185
|
+
email_outro: Recibiches esta notificación porque es a persoa autora deste comentario.
|
|
186
|
+
email_subject: O teu comentario en «%{resource_title}» recibiu unha valoración positiva.
|
|
187
|
+
notification_title: O teu <a href="%{resource_path}">comentario</a> en «%{resource_title}» recibiu unha valoración positiva. Agora ten un total de %{upvotes} valoracións positivas e %{downvotes} negativas.
|
|
116
188
|
reply_created:
|
|
117
189
|
email_intro: "%{author_name} respondeu o teu comentario en %{resource_title}. Podes lelo nesta páxina:"
|
|
118
190
|
email_outro: Recibiches esta notificación porque o teu comentario foi respondido.
|
|
119
191
|
email_subject: "%{author_name} respondeu o teu comentario en %{resource_title}"
|
|
192
|
+
notification_title: <a href="%{author_path}">%{author_name}</a> respondeu ao teu comentario en <a href="%{resource_path}">%{resource_title}</a>
|
|
120
193
|
user_mentioned:
|
|
121
194
|
email_intro: Foi mencionado
|
|
122
195
|
email_outro: Recibiches esta notificación porque foi mencionado en %{resource_title}.
|
|
123
196
|
email_subject: Foi mencionado en %{resource_title}
|
|
197
|
+
notification_title: <a href="%{author_path}">%{author_name}</a> mencionoute en <a href="%{resource_path}">%{resource_title}</a>
|
|
198
|
+
errors:
|
|
199
|
+
messages:
|
|
200
|
+
cannot_have_comments: non pode ter comentarios
|
data/config/locales/sk.yml
CHANGED
|
@@ -185,10 +185,12 @@ sk:
|
|
|
185
185
|
email_intro: "%{author_name} komentoval na %{resource_title}. Môžete si to prečítať na stránke:"
|
|
186
186
|
email_outro: Túto notifikáciu ste dostali, pretože sledujete autora "%{author_name}". Notifikácie môžete zrušiť po kliknutí na predchádzajúci odkaz.
|
|
187
187
|
email_subject: Je nový komentár od %{author_name} na %{resource_title}
|
|
188
|
+
notification_title: V <a href="%{resource_path}">%{resource_title}</a> je nový komentár od <a href="%{author_path}">%{author_name}</a>.
|
|
188
189
|
comment_created:
|
|
189
190
|
email_intro: "%{resource_title} bol okomentovaný. Komentár si môžete prečítať na stránke:"
|
|
190
191
|
email_outro: Túto notifikáciu ste dostali, pretože sledujete "%{resource_title}" alebo autora. Notifikácie môžete zrušiť po kliknutí na predchádzajúci odkaz.
|
|
191
192
|
email_subject: Je nový komentár od %{author_name} na %{resource_title}
|
|
193
|
+
notification_title: V <a href="%{resource_path}">%{resource_title}</a> je nový komentár od <a href="%{author_path}">%{author_name}</a>
|
|
192
194
|
comment_downvoted:
|
|
193
195
|
email_intro: Váš komentár v „%{resource_title}“ získal negatívny hlas. Teraz má celkovo %{upvotes} pozitívnych hlasov a %{downvotes} negatívnych hlasov.
|
|
194
196
|
email_outro: Toto upozornenie ste dostali, pretože ste autorom tohto komentára.
|
|
@@ -203,10 +205,12 @@ sk:
|
|
|
203
205
|
email_intro: "%{author_name} odpovedal na váš komentár na %{resource_title}. Môžete si to prečítať na stránke:"
|
|
204
206
|
email_outro: Túto notifikáciu ste dostali, pretože niekto odpovedal na Váš komentár.
|
|
205
207
|
email_subject: "%{author_name} odpovedal na Váš komentár na %{resource_title}"
|
|
208
|
+
notification_title: <a href="%{author_path}">%{author_name}</a> odpovedal/a na váš komentár v <a href="%{resource_path}">%{resource_title}</a>
|
|
206
209
|
user_mentioned:
|
|
207
210
|
email_intro: Niekto vás spomenul
|
|
208
211
|
email_outro: Túto notifikáciu ste dostali, pretože ste boli spomenutí na %{resource_title}.
|
|
209
212
|
email_subject: Boli ste spomenutí na %{resource_title}
|
|
213
|
+
notification_title: <a href="%{author_path}">%{author_name}</a> vás spomenul/a v <a href="%{resource_path}">%{resource_title}</a>
|
|
210
214
|
errors:
|
|
211
215
|
messages:
|
|
212
216
|
cannot_have_comments: nemôže mať komentáre
|
data/config/locales/sv.yml
CHANGED
|
@@ -81,7 +81,11 @@ sv:
|
|
|
81
81
|
hide_replies:
|
|
82
82
|
one: Dölj svar
|
|
83
83
|
other: Dölj %{count} svar
|
|
84
|
+
load_replies: Ladda svar
|
|
84
85
|
moderated_at: Kommentar modererad %{date}
|
|
86
|
+
replies_count:
|
|
87
|
+
one: "%{count} svar"
|
|
88
|
+
other: "%{count} svar"
|
|
85
89
|
reply: Svara
|
|
86
90
|
report:
|
|
87
91
|
action: Rapportera
|
|
@@ -113,7 +117,9 @@ sv:
|
|
|
113
117
|
blocked_comments_warning: Kommentarer är inaktiverade, endast administratörer kan svara eller skriva nya.
|
|
114
118
|
comment_details_title: Kommentarsdetaljer
|
|
115
119
|
in_favor: För
|
|
120
|
+
load_more_comments: Läs in fler kommentarer
|
|
116
121
|
loading: Laddar kommentarer...
|
|
122
|
+
no_comments_yet: Inga kommentarer ännu
|
|
117
123
|
single_comment_warning: <a href="%{url}">Visa alla kommentarer</a>
|
|
118
124
|
single_comment_warning_title: Du visar en enda kommentar
|
|
119
125
|
title:
|
|
@@ -163,12 +169,12 @@ sv:
|
|
|
163
169
|
email_intro: "%{author_name} har lämnat en kommentar i %{resource_title}. Du kan läsa den på den här sidan:"
|
|
164
170
|
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.
|
|
165
171
|
email_subject: Det finns en ny kommentar av %{author_name} i %{resource_title}
|
|
166
|
-
notification_title:
|
|
172
|
+
notification_title: Ny kommentar av <a href="%{author_path}">%{author_name}</a> i <a href="%{resource_path}">%{resource_title}</a>.
|
|
167
173
|
comment_created:
|
|
168
174
|
email_intro: "%{resource_title} har kommenterats. Du kan läsa kommentaren på den här sidan:"
|
|
169
175
|
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.
|
|
170
176
|
email_subject: Det finns en ny kommentar från %{author_name} i %{resource_title}
|
|
171
|
-
notification_title:
|
|
177
|
+
notification_title: Ny kommentar från <a href="%{author_path}">%{author_name}</a> i <a href="%{resource_path}">%{resource_title}</a>
|
|
172
178
|
comment_downvoted:
|
|
173
179
|
email_intro: Din kommentar i "%{resource_title}" har blivit nedröstad. Den har nu totalt %{upvotes} uppröster och %{downvotes} nedröster.
|
|
174
180
|
email_outro: Du har fått det här meddelandet eftersom du är författare till denna kommentar.
|
|
@@ -183,7 +189,7 @@ sv:
|
|
|
183
189
|
email_intro: "%{author_name} har svarat din kommentar i %{resource_title}. Du kan läsa den på den här sidan:"
|
|
184
190
|
email_outro: Du har fått denna notis eftersom din kommentar blev besvarad.
|
|
185
191
|
email_subject: "%{author_name} har svarat din kommentar i %{resource_title}"
|
|
186
|
-
notification_title: <a href="%{author_path}">%{author_name}</a>
|
|
192
|
+
notification_title: <a href="%{author_path}">%{author_name}</a> har svarat på din kommentar i <a href="%{resource_path}">%{resource_title}</a>
|
|
187
193
|
user_mentioned:
|
|
188
194
|
email_intro: Du har nämnts
|
|
189
195
|
email_outro: Du har fått denna notis eftersom du har nämnts i %{resource_title}.
|
data/decidim-comments.gemspec
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |s|
|
|
6
|
-
version = "0.32.
|
|
6
|
+
version = "0.32.3"
|
|
7
7
|
s.version = version
|
|
8
8
|
s.authors = ["Josep Jaume Rey Peroy", "Marc Riera Casals", "Oriol Gual Oliva"]
|
|
9
9
|
s.email = ["josepjaume@gmail.com", "mrc2407@gmail.com", "oriolgual@gmail.com"]
|
|
@@ -30,6 +30,8 @@ module Decidim
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def commentable(id:, type:, locale: Decidim.default_locale, toggle_translations: false)
|
|
33
|
+
raise GraphQL::ExecutionError, "Invalid commentable type" unless valid_commentable_type?(type)
|
|
34
|
+
|
|
33
35
|
I18n.locale = locale.presence
|
|
34
36
|
RequestStore.store[:toggle_machine_translations] = toggle_translations
|
|
35
37
|
type.constantize.find(id)
|
|
@@ -40,6 +42,16 @@ module Decidim
|
|
|
40
42
|
RequestStore.store[:toggle_machine_translations] = toggle_translations
|
|
41
43
|
Comment.find(id)
|
|
42
44
|
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def valid_commentable_type?(type)
|
|
49
|
+
klass = type.safe_constantize
|
|
50
|
+
return false unless klass
|
|
51
|
+
return false unless klass.is_a?(Class)
|
|
52
|
+
|
|
53
|
+
klass.include?(Decidim::Comments::Commentable)
|
|
54
|
+
end
|
|
43
55
|
end
|
|
44
56
|
end
|
|
45
57
|
end
|
|
@@ -21,6 +21,7 @@ module Decidim
|
|
|
21
21
|
|
|
22
22
|
def commentable(id:, locale:, toggle_translations:, type:)
|
|
23
23
|
raise GraphQL::ExecutionError, "#{locale} is not a valid locale" unless available_locales.include?(locale)
|
|
24
|
+
raise GraphQL::ExecutionError, "Invalid commentable type" unless valid_commentable_type?(type)
|
|
24
25
|
|
|
25
26
|
I18n.locale = locale.presence
|
|
26
27
|
RequestStore.store[:toggle_machine_translations] = toggle_translations
|
|
@@ -29,6 +30,14 @@ module Decidim
|
|
|
29
30
|
|
|
30
31
|
private
|
|
31
32
|
|
|
33
|
+
def valid_commentable_type?(type)
|
|
34
|
+
klass = type.safe_constantize
|
|
35
|
+
return false unless klass
|
|
36
|
+
return false unless klass.is_a?(Class)
|
|
37
|
+
|
|
38
|
+
klass.include?(Decidim::Comments::Commentable)
|
|
39
|
+
end
|
|
40
|
+
|
|
32
41
|
def available_locales
|
|
33
42
|
if context[:current_organization].present?
|
|
34
43
|
context[:current_organization].available_locales
|
|
@@ -22,7 +22,7 @@ module Decidim
|
|
|
22
22
|
|
|
23
23
|
@organization = resource.organization
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
config_value(:comments_count).times do
|
|
26
26
|
comment1 = create_comment(resource)
|
|
27
27
|
NewCommentNotificationCreator.new(comment1, []).create
|
|
28
28
|
|
|
@@ -43,7 +43,10 @@ module Decidim
|
|
|
43
43
|
attr_reader :organization
|
|
44
44
|
|
|
45
45
|
def config_value(key)
|
|
46
|
-
slow_seeds? ? Decidim::Seeds::SEEDS_CONFIG[key][:slow] : Decidim::Seeds::SEEDS_CONFIG[key][:fast]
|
|
46
|
+
value = slow_seeds? ? Decidim::Seeds::SEEDS_CONFIG[key][:slow] : Decidim::Seeds::SEEDS_CONFIG[key][:fast]
|
|
47
|
+
return rand(value) if value.is_a?(Range)
|
|
48
|
+
|
|
49
|
+
value
|
|
47
50
|
end
|
|
48
51
|
|
|
49
52
|
def slow_seeds?
|
|
@@ -60,10 +63,13 @@ module Decidim
|
|
|
60
63
|
# @return [Decidim::Comments::Comment]
|
|
61
64
|
def create_comment(resource, root_commentable = nil)
|
|
62
65
|
author = random_user
|
|
66
|
+
root = root_commentable || resource
|
|
67
|
+
space = root.respond_to?(:participatory_space) ? root.participatory_space : root
|
|
63
68
|
|
|
64
69
|
params = {
|
|
65
70
|
commentable: resource,
|
|
66
|
-
root_commentable:
|
|
71
|
+
root_commentable: root,
|
|
72
|
+
participatory_space: space,
|
|
67
73
|
body: { en: ::Faker::Lorem.sentence(word_count: 50) },
|
|
68
74
|
author:
|
|
69
75
|
}
|
data/lib/decidim/comments.rb
CHANGED
|
@@ -18,6 +18,7 @@ module Decidim
|
|
|
18
18
|
autoload :CommentVoteSerializer, "decidim/comments/comment_vote_serializer"
|
|
19
19
|
autoload :Export, "decidim/comments/export"
|
|
20
20
|
autoload :Markdown, "decidim/comments/markdown"
|
|
21
|
+
autoload :Seed, "decidim/comments/seed"
|
|
21
22
|
|
|
22
23
|
def self.data_portable_entities
|
|
23
24
|
["Decidim::Comments::Comment", "Decidim::Comments::CommentVote"]
|
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.32.
|
|
4
|
+
version: 0.32.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josep Jaume Rey Peroy
|
|
@@ -17,14 +17,14 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - '='
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: 0.32.
|
|
20
|
+
version: 0.32.3
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
25
|
- - '='
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: 0.32.
|
|
27
|
+
version: 0.32.3
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
29
|
name: redcarpet
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -51,28 +51,28 @@ dependencies:
|
|
|
51
51
|
requirements:
|
|
52
52
|
- - '='
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.32.
|
|
54
|
+
version: 0.32.3
|
|
55
55
|
type: :development
|
|
56
56
|
prerelease: false
|
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - '='
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0.32.
|
|
61
|
+
version: 0.32.3
|
|
62
62
|
- !ruby/object:Gem::Dependency
|
|
63
63
|
name: decidim-dev
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - '='
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 0.32.
|
|
68
|
+
version: 0.32.3
|
|
69
69
|
type: :development
|
|
70
70
|
prerelease: false
|
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
73
|
- - '='
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.32.
|
|
75
|
+
version: 0.32.3
|
|
76
76
|
description: Pluggable comments system for some components.
|
|
77
77
|
email:
|
|
78
78
|
- josepjaume@gmail.com
|
|
@@ -138,7 +138,6 @@ files:
|
|
|
138
138
|
- app/models/decidim/comments/application_record.rb
|
|
139
139
|
- app/models/decidim/comments/comment.rb
|
|
140
140
|
- app/models/decidim/comments/comment_vote.rb
|
|
141
|
-
- app/models/decidim/comments/seed.rb
|
|
142
141
|
- app/packs/entrypoints/decidim_comments.js
|
|
143
142
|
- app/packs/src/decidim/comments/comments.component.js
|
|
144
143
|
- app/packs/src/decidim/comments/comments.component.test.js
|
|
@@ -298,6 +297,7 @@ files:
|
|
|
298
297
|
- lib/decidim/comments/markdown.rb
|
|
299
298
|
- lib/decidim/comments/mutation_extensions.rb
|
|
300
299
|
- lib/decidim/comments/query_extensions.rb
|
|
300
|
+
- lib/decidim/comments/seed.rb
|
|
301
301
|
- lib/decidim/comments/test.rb
|
|
302
302
|
- lib/decidim/comments/test/factories.rb
|
|
303
303
|
- lib/decidim/comments/test/shared_examples/comment_event.rb
|