decidim-comments 0.31.7 → 0.31.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ef4324547a6ac84299c5cdd0cb0756f68053150a3659ca90fb2ada241a7c2f7
4
- data.tar.gz: ab8742a0688abcf1b3169def06175e76ce104d5abd3c39576f10d3cfae0cd14f
3
+ metadata.gz: dc7a0ddffe6de6f6d7eed337a75fea555317a4e7ecb1718fe6c57cb3eca10c41
4
+ data.tar.gz: ac33b8cc0f1dc52adf6191e41f5b901c7f12b308fdaa805404e130e225a79216
5
5
  SHA512:
6
- metadata.gz: 57a3d57fb15a230c72b20958d5c8049b37340fea9acc02185312f8f1acd9183676a74c6015514e76756adf36d4ed77e54d24f864eff4bd0fe4c2f4f744c59def
7
- data.tar.gz: 7bb94666799b1ad8d3c4e1e130bc333a1f291785930114d004fc11a9d0581005627c58905a4f6cd41e78ef03ca6e87dadd6aa4d61207204bf91b8fb19964a837
6
+ metadata.gz: 8d04fa166dc529cd4e8dbe9bca659c85c72744d3a9f73cf1bc9f5bf4addd85a2611abf259a56f234dc768c5b8ef5e77159f4c83efeff94d55e081d169d61ab69
7
+ data.tar.gz: 116e856f67bf8d938b069628e3acddaba8d44e9b18c974769f4efd63d33d4b0f55648b260de8536caef7788a9cdfeb28a09e03dcaf79119b3eb5e5fddafe4874
@@ -5,6 +5,8 @@ module Decidim
5
5
  # This controller is the abstract class from which all other controllers of
6
6
  # this engine inherit.
7
7
  class ApplicationController < Decidim::ApplicationController
8
+ protected
9
+
8
10
  def permission_class_chain
9
11
  [
10
12
  ::Decidim::Comments::Permissions,
@@ -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
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:)
@@ -138,7 +138,7 @@ export default class CommentsComponent {
138
138
  * @returns {String} - Returns a unique identifier
139
139
  */
140
140
  _getUID() {
141
- return `comments-${new Date().setUTCMilliseconds()}-${Math.floor(Math.random() * 10000000)}`;
141
+ return `comments-${new Date().getUTCMilliseconds()}-${Math.floor(Math.random() * 10000000)}`;
142
142
  }
143
143
 
144
144
  /**
@@ -375,6 +375,12 @@ describe("CommentsComponent", () => {
375
375
  expect(CommentsComponent).toBeDefined();
376
376
  });
377
377
 
378
+ it("generates an ID if not defined", () => {
379
+ const dummyElement = document.createElement("div");
380
+ const component = new CommentsComponent($(dummyElement), {});
381
+ expect(component.id).toMatch(/^comments-\d{1,3}-\d+$/);
382
+ });
383
+
378
384
  it("initializes unmounted", () => {
379
385
  expect(subject.mounted).toBeFalsy();
380
386
  });
@@ -166,12 +166,12 @@ ca:
166
166
  email_intro: "%{author_name} ha deixat un comentari a %{resource_title}. Podeu llegir-lo en aquesta pàgina:"
167
167
  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.
168
168
  email_subject: Hi ha un nou comentari de %{author_name} en %{resource_title}
169
- notification_title: Hi ha un nou comentari de <a href="%{author_path}">%{author_name}</a> a<a href="%{resource_path}">%{resource_title}</a>.
169
+ notification_title: Hi ha un nou comentari de <a href="%{author_path}">%{author_name}</a> a <a href="%{resource_path}">%{resource_title}</a>.
170
170
  comment_created:
171
171
  email_intro: "Algú ha deixat un comentari a \"%{resource_title}\". Pots llegir el comentari a través del següent enllaç:"
172
172
  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.
173
173
  email_subject: Hi ha un nou comentari de %{author_name} a %{resource_title}
174
- notification_title: Hi ha un nou comentari de <a href="%{author_path}">%{author_name}</a> a<a href="%{resource_path}">%{resource_title}</a>
174
+ notification_title: Hi ha un nou comentari de <a href="%{author_path}">%{author_name}</a> a <a href="%{resource_path}">%{resource_title}</a>
175
175
  comment_downvoted:
176
176
  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.
177
177
  email_outro: Has rebut aquesta notificació perquè vas fer aquest comentari.
@@ -191,7 +191,7 @@ ca:
191
191
  email_intro: Has estat esmentada
192
192
  email_outro: Has rebut aquesta notificació perquè t'han esmentat al comentari "%{resource_title}".
193
193
  email_subject: Has estat esmentada a %{resource_title}
194
- notification_title: Has estat esmentada per <a href="%{author_path}">%{author_name}</a> a <a href="%{resource_path}">%{resource_title}</a>
194
+ notification_title: T'han esmentat per <a href="%{author_path}">%{author_name}</a> a <a href="%{resource_path}">%{resource_title}</a>
195
195
  errors:
196
196
  messages:
197
197
  cannot_have_comments: no es poden fer comentaris
@@ -166,10 +166,12 @@ de:
166
166
  email_intro: "%{author_name} hat einen Kommentar zu %{resource_title} hinterlassen. Sie können diesen auf dieser Seite lesen:"
167
167
  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.
168
168
  email_subject: Neuer Kommentar von %{author_name} zu %{resource_title}
169
+ notification_title: Es gibt einen neuen Kommentar von <a href="%{author_path}">%{author_name}</a> zu <a href="%{resource_path}">%{resource_title}</a>.
169
170
  comment_created:
170
171
  email_intro: "%{resource_title} wurde kommentiert. Sie können den Kommentar auf dieser Seite lesen:"
171
172
  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.
172
173
  email_subject: Neuer Kommentar von %{author_name} zu %{resource_title}
174
+ notification_title: Es gibt einen neuen Kommentar von <a href="%{author_path}">%{author_name}</a> zu <a href="%{resource_path}">%{resource_title}</a>
173
175
  comment_downvoted:
174
176
  email_intro: Ihr Kommentar in "%{resource_title}" wurde negativ bewertet. Er hat nun insgesamt %{upvotes} positive und %{downvotes} negative Stimmen.
175
177
  email_outro: Sie haben diese Benachrichtigung erhalten, weil Sie der Autor des Vorschlags sind.
@@ -184,10 +186,12 @@ de:
184
186
  email_intro: "%{author_name} hat auf Ihren Kommentar zu %{resource_title} geantwortet. Sie können das auf dieser Seite lesen:"
185
187
  email_outro: Sie haben diese Benachrichtigung erhalten, weil Ihr Kommentar beantwortet wurde.
186
188
  email_subject: "%{author_name} hat auf Ihren Kommentar zu %{resource_title} geantwortet"
189
+ notification_title: <a href="%{author_path}">%{author_name}</a> hat auf Ihren Kommentar zu <a href="%{resource_path}">%{resource_title}</a> geantwortet
187
190
  user_mentioned:
188
191
  email_intro: Sie wurden erwähnt
189
192
  email_outro: Sie haben diese Benachrichtigung erhalten, weil Sie in %{resource_title} erwähnt wurden.
190
193
  email_subject: Sie wurden in %{resource_title} erwähnt
194
+ notification_title: Sie wurden von <a href="%{author_path}">%{author_name}</a> in <a href="%{resource_path}">%{resource_title}</a> erwähnt
191
195
  errors:
192
196
  messages:
193
197
  cannot_have_comments: kann keine Kommentare haben
@@ -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} kakaktere geratzen dira"
65
- remaining_characters_1: "%{count} kakaktere geratzen dira"
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:
@@ -96,11 +96,11 @@ eu:
96
96
  does_not_belong: Bertan badago legez kontrako jardunik, suizidio-mehatxurik, informazio pertsonalik edo beste zernahi, zure ustez %{organization_name}-ri ez dagokionik.
97
97
  offensive: Arrazakeria, sexismoa, laidoak, eraso pertsonalak, heriotza-mehatxuak, suizidio eskaerak edo gorrotozko edozein diskurtso.
98
98
  spam: Bertan badago clickbait-ik, publizitaterik edo iruzurrik.
99
- title: Jakinarazi eduki desegokia
99
+ title: Eduki desegokia salatu
100
100
  show_replies:
101
- one: Erakutsi %{count} erantzun
101
+ one: Erakutsi erantzun %{count}
102
102
  other: Erakutsi %{count} erantzun
103
- single_comment_link_title: Lortu esteka
103
+ single_comment_link_title: Esteka lortu
104
104
  sort_by: 'Nork sortua:'
105
105
  comment_order_selector:
106
106
  order:
@@ -120,7 +120,7 @@ eu:
120
120
  single_comment_warning: <a href="%{url}"> iruzkin guztiak ikusgai </a>
121
121
  single_comment_warning_title: Iruzkin bakar bat ikusten ari zara
122
122
  title:
123
- one: "Iruzkin bat"
123
+ one: "Iruzkin %{count}"
124
124
  other: "%{count} iruzkin"
125
125
  top_comment_label: Babes gehien galdu dituztenak
126
126
  down_vote_button:
@@ -145,9 +145,9 @@ eu:
145
145
  help:
146
146
  comment_votes:
147
147
  comment: Bozkatutako iruzkinaren identifikazioa
148
- created_at: Zein datatan sortu zen bozketa hau
148
+ created_at: Zein datatan sortu den bozketa hau
149
149
  id: Babesaren identifikazioa
150
- updated_at: Zein datatan eguneratu zen azken aldiz bozketa hau
150
+ updated_at: Zein datatan eguneratu den azken aldiz bozketa hau
151
151
  weight: Babesaren balioa (1 boto gehiago, -1 boto gutxiago)
152
152
  comments:
153
153
  alignment: Iruzkin hau aldekoa bazen, kontrakoa edo neutrala
@@ -155,7 +155,7 @@ eu:
155
155
  body: Iruzkina bera
156
156
  commentable_id: Iruzkingarriaren identifikazio bakarra
157
157
  commentable_type: Iruzkingarri mota (emaitza, proposamena... bazen)
158
- created_at: Zein datatan sortu zen iruzkin hau
158
+ created_at: Zein datatan sortu den iruzkin hau
159
159
  depth: Zein lekutan dago iruzkin hau hiru iruzkinetan (iruzkinaren erantzuna bada edo erantzunaren erantzuna bada)
160
160
  id: Identifikazioa iruzkin honetarako
161
161
  locale: Parte-hartzaileak iruzkin hau uztean erabili du tokiko hizkuntza
@@ -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.)
@@ -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: Votos
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 votar o comentario.
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,12 +68,19 @@ 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
64
84
  moderated_at: Comentario moderado o %{date}
65
85
  reply: Responder
66
86
  report:
@@ -70,10 +90,15 @@ gl:
70
90
  description: Este contido é inapropiado?
71
91
  details: Comentarios adicionais
72
92
  reasons:
93
+ 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
94
  offensive: Contén racismo, sexismo, abuso, ataques persoais, ameazas de morte, solicitudes de suicidio ou calquera tipo de discurso de odio.
74
95
  spam: Contén clic, publicidade, fraudes ou bots de script.
75
96
  title: Denunciar contido inapropiado
97
+ show_replies:
98
+ one: Mostrar resposta
99
+ other: Mostrar %{count} respostas
76
100
  single_comment_link_title: Obter ligazón
101
+ sort_by: 'Ordenar por: '
77
102
  comment_order_selector:
78
103
  order:
79
104
  best_rated: Mellor valorado
@@ -82,16 +107,23 @@ gl:
82
107
  recent: Recentes
83
108
  title: 'Ordenar por:'
84
109
  comments:
110
+ against: En contra
85
111
  blocked_comments_for_unauthorized_user_warning: Tes de estar verificado para poder comentar neste intre, porén podes ler os comentarios anteriores.
86
112
  blocked_comments_for_user_warning: Non podes comentar neste momento, pero podes ler os anteriores.
113
+ blocked_comments_warning: Os comentarios están desactivados neste momento; só as persoas administradoras poden responder ou publicar novos comentarios.
87
114
  comment_details_title: Detalles do comentario
115
+ in_favor: A favor
88
116
  loading: Cargando comentarios ...
89
117
  single_comment_warning: <a href="%{url}">Ver todos os comentarios</a>
90
118
  single_comment_warning_title: Estás a ver un único comentario
91
119
  title:
92
120
  one: "%{count} comentario"
93
121
  other: "%{count} comentarios"
122
+ top_comment_label: Mellor valorado
94
123
  down_vote_button:
124
+ label:
125
+ one: Botón «Non me gusta». %{count} valoración negativa
126
+ other: Botón «Non me gusta». %{count} valoracións negativas
95
127
  text: Non estou de acordo con este comentario
96
128
  edit_comment_modal_form:
97
129
  close: Pechar
@@ -102,22 +134,61 @@ gl:
102
134
  submit: Enviar
103
135
  title: Editar o teu comentario
104
136
  up_vote_button:
137
+ label:
138
+ one: Botón «Gústame». %{count} valoración positiva
139
+ other: Botón «Gústame». %{count} valoracións positivas
105
140
  text: Estou de acordo con este comentario
141
+ download_your_data:
142
+ help:
143
+ comment_votes:
144
+ comment: O identificador do comentario que se valorou
145
+ created_at: A data na que se creou esta valoración
146
+ id: O identificador da valoración
147
+ updated_at: A data da última actualización desta valoración
148
+ weight: O peso da valoración (1 para positiva e -1 para negativa)
149
+ comments:
150
+ alignment: Se este comentario foi a favor, en contra ou neutral
151
+ author: O nome da persoa participante que fixo este comentario
152
+ body: O propio comentario
153
+ commentable_id: O identificador único do recurso comentable
154
+ commentable_type: O tipo de recurso comentable (se era un resultado, unha proposta etc.)
155
+ created_at: A data na que se creou este comentario
156
+ depth: A posición deste comentario na árbore de comentarios (se é unha resposta ou unha resposta a outra resposta)
157
+ id: O identificador deste comentario
158
+ locale: A configuración rexional (idioma) da persoa participante cando deixou este comentario
159
+ root_commentable_url: O URL do recurso ao que está vinculado este comentario
106
160
  events:
107
161
  comments:
108
162
  comment_by_followed_user:
109
163
  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 usuario desde a súa páxina de perfil.
164
+ 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
165
  email_subject: Hai un novo comentario por %{author_name} en %{resource_title}
166
+ notification_title: Hai un novo comentario de <a href="%{author_path}">%{author_name}</a> en <a href="%{resource_path}">%{resource_title}</a>.
112
167
  comment_created:
113
168
  email_intro: "Comentouse %{resource_title} . Podes ler o comentario nesta páxina:"
114
169
  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
170
  email_subject: Hai un novo comentario de %{author_name} en %{resource_title}
171
+ notification_title: Hai un novo comentario de <a href="%{author_path}">%{author_name}</a> en <a href="%{resource_path}">%{resource_title}</a>
172
+ comment_downvoted:
173
+ 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.
174
+ email_outro: Recibiches esta notificación porque es a persoa autora deste comentario.
175
+ email_subject: O teu comentario en «%{resource_title}» recibiu unha valoración negativa.
176
+ 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.
177
+ comment_upvoted:
178
+ 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.
179
+ email_outro: Recibiches esta notificación porque es a persoa autora deste comentario.
180
+ email_subject: O teu comentario en «%{resource_title}» recibiu unha valoración positiva.
181
+ 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
182
  reply_created:
117
183
  email_intro: "%{author_name} respondeu o teu comentario en %{resource_title}. Podes lelo nesta páxina:"
118
184
  email_outro: Recibiches esta notificación porque o teu comentario foi respondido.
119
185
  email_subject: "%{author_name} respondeu o teu comentario en %{resource_title}"
186
+ notification_title: <a href="%{author_path}">%{author_name}</a> respondeu ao teu comentario en <a href="%{resource_path}">%{resource_title}</a>
120
187
  user_mentioned:
121
188
  email_intro: Foi mencionado
122
189
  email_outro: Recibiches esta notificación porque foi mencionado en %{resource_title}.
123
190
  email_subject: Foi mencionado en %{resource_title}
191
+ notification_title: <a href="%{author_path}">%{author_name}</a> mencionoute en <a href="%{resource_path}">%{resource_title}</a>
192
+ errors:
193
+ messages:
194
+ cannot_have_comments: non pode ter comentarios
@@ -166,12 +166,12 @@ sv:
166
166
  email_intro: "%{author_name} har lämnat en kommentar i %{resource_title}. Du kan läsa den på den här sidan:"
167
167
  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.
168
168
  email_subject: Det finns en ny kommentar av %{author_name} i %{resource_title}
169
- notification_title: Det finns en ny kommentar av <a href="%{author_path}">%{author_name}</a> i <a href="%{resource_path}">%{resource_title}</a>.
169
+ notification_title: Ny kommentar av <a href="%{author_path}">%{author_name}</a> i <a href="%{resource_path}">%{resource_title}</a>.
170
170
  comment_created:
171
171
  email_intro: "%{resource_title} har kommenterats. Du kan läsa kommentaren på den här sidan:"
172
172
  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.
173
173
  email_subject: Det finns en ny kommentar från %{author_name} i %{resource_title}
174
- notification_title: Det finns en ny kommentar från <a href="%{author_path}">%{author_name}</a> i <a href="%{resource_path}">%{resource_title}</a>
174
+ notification_title: Ny kommentar från <a href="%{author_path}">%{author_name}</a> i <a href="%{resource_path}">%{resource_title}</a>
175
175
  comment_downvoted:
176
176
  email_intro: Din kommentar i "%{resource_title}" har blivit nedröstad. Den har nu totalt %{upvotes} uppröster och %{downvotes} nedröster.
177
177
  email_outro: Du har fått det här meddelandet eftersom du är författare till denna kommentar.
@@ -186,7 +186,7 @@ sv:
186
186
  email_intro: "%{author_name} har svarat din kommentar i %{resource_title}. Du kan läsa den på den här sidan:"
187
187
  email_outro: Du har fått denna notis eftersom din kommentar blev besvarad.
188
188
  email_subject: "%{author_name} har svarat din kommentar i %{resource_title}"
189
- notification_title: <a href="%{author_path}">%{author_name}</a> besvarade din kommentar i <a href="%{resource_path}">%{resource_title}</a>
189
+ notification_title: <a href="%{author_path}">%{author_name}</a> har svarat på din kommentar i <a href="%{resource_path}">%{resource_title}</a>
190
190
  user_mentioned:
191
191
  email_intro: Du har nämnts
192
192
  email_outro: Du har fått denna notis eftersom du har nämnts i %{resource_title}.
@@ -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
@@ -7,7 +7,7 @@ FactoryBot.define do
7
7
  transient do
8
8
  skip_injection { false }
9
9
  end
10
- author { build(:user, organization: commentable.organization, skip_injection:) }
10
+ author { build(:user, :confirmed, organization: commentable.organization, skip_injection:) }
11
11
  commentable { build(:dummy_resource, :published, skip_injection:) }
12
12
  root_commentable { commentable }
13
13
  body { Decidim::Faker::Localized.paragraph }
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-comments version.
5
5
  module Comments
6
6
  def self.version
7
- "0.31.7"
7
+ "0.31.8"
8
8
  end
9
9
  end
10
10
  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.31.7
4
+ version: 0.31.8
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: 2026-07-30 00:00:00.000000000 Z
13
+ date: 2026-10-22 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.31.7
21
+ version: 0.31.8
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.31.7
28
+ version: 0.31.8
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.31.7
55
+ version: 0.31.8
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.31.7
62
+ version: 0.31.8
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.31.7
69
+ version: 0.31.8
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.31.7
76
+ version: 0.31.8
77
77
  description: Pluggable comments system for some components.
78
78
  email:
79
79
  - josepjaume@gmail.com