decidim-comments 0.28.0 → 0.28.1
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/show.erb +3 -3
- data/app/cells/decidim/comments/comment_cell.rb +6 -4
- data/app/models/decidim/comments/comment.rb +2 -2
- data/app/models/decidim/comments/comment_vote.rb +10 -0
- data/app/packs/src/decidim/comments/comments.component.test.js +2 -2
- data/app/packs/src/decidim/comments/comments.component_for_testing.js +1 -0
- data/config/locales/ca.yml +7 -7
- data/config/locales/es.yml +7 -7
- data/config/locales/he-IL.yml +1 -0
- data/config/locales/hu.yml +5 -0
- data/config/locales/pl.yml +2 -0
- data/config/locales/ro-RO.yml +8 -4
- data/config/locales/sq-AL.yml +42 -0
- data/db/migrate/20240304092558_add_comment_vote_counter_cache_to_comments.rb +21 -0
- data/decidim-comments.gemspec +40 -0
- data/lib/decidim/api/comment_type.rb +2 -2
- data/lib/decidim/comments/test/factories.rb +14 -7
- data/lib/decidim/comments/test/shared_examples/comment_event.rb +1 -1
- data/lib/decidim/comments/test/shared_examples/comment_voted_event.rb +1 -1
- data/lib/decidim/comments/version.rb +1 -1
- metadata +17 -15
- data/config/environment.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f56674cf1871898096ef02f63583abeb149286e0500056e747b74be60e2028ed
|
4
|
+
data.tar.gz: 8d6a096ed694a4a833c376c9a9c7fe1cf0b691dd571fd33bdc439796f025d3b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76c1112767d32925c6ebc0ee12e153f050b4814554aca1357aecfb905bdb734541d104d65208b5cfcdade9792a225cb83b1c1e5afd34a31984c9af2d35d3f604
|
7
|
+
data.tar.gz: 52718130d906ccc942afaff78dd4e75ba5274c6bf88bd8b3fd8aa4215c74afc005a09c7e6f0493340c56d1adca7ed2a48c782413ee13a561a157abd90f7cd549
|
@@ -30,20 +30,20 @@
|
|
30
30
|
</li>
|
31
31
|
<% end %>
|
32
32
|
<li>
|
33
|
-
<%= link_to "#{commentable_path("commentId" => model.id)}#comment_#{model.id}", target: "_blank", data: { "external-link": "
|
33
|
+
<%= link_to "#{commentable_path("commentId" => model.id)}#comment_#{model.id}", target: "_blank", data: { "external-link": "text-only" }, class: "dropdown__item", title: t("decidim.components.comment.single_comment_link_title") do %>
|
34
34
|
<%= icon "share-line" %>
|
35
35
|
<span><%= t("decidim.components.comment.single_comment_link_title") %></span>
|
36
36
|
<% end %>
|
37
37
|
</li>
|
38
38
|
<% if model.authored_by?(current_user) %>
|
39
39
|
<li>
|
40
|
-
<button type="button" class="dropdown__item" data-dialog-open="<%= "editCommentModal#{model.id}" %>" title="<%= t("decidim.components.comment.edit") %>" aria-controls="<%= "editCommentModal#{model.id}" %>" aria-haspopup="dialog"
|
40
|
+
<button type="button" class="dropdown__item" data-dialog-open="<%= "editCommentModal#{model.id}" %>" title="<%= t("decidim.components.comment.edit") %>" aria-controls="<%= "editCommentModal#{model.id}" %>" aria-haspopup="dialog">
|
41
41
|
<%= icon "edit-line" %>
|
42
42
|
<span><%= t("decidim.components.comment.edit") %></span>
|
43
43
|
</button>
|
44
44
|
</li>
|
45
45
|
<li>
|
46
|
-
<%= link_to comment_path, remote: true, method: :delete, class: "dropdown__item", data: { confirm: t("decidim.components.comment.confirm_destroy") }
|
46
|
+
<%= link_to comment_path, remote: true, method: :delete, class: "dropdown__item", data: { confirm: t("decidim.components.comment.confirm_destroy") } do %>
|
47
47
|
<%= icon "delete-bin-line" %>
|
48
48
|
<span><%= t("decidim.components.comment.delete") %></span>
|
49
49
|
<% end %>
|
@@ -47,6 +47,8 @@ module Decidim
|
|
47
47
|
hash.push(model.must_render_translation?(current_organization) ? 1 : 0)
|
48
48
|
hash.push(model.authored_by?(current_user) ? 1 : 0)
|
49
49
|
hash.push(model.reported_by?(current_user) ? 1 : 0)
|
50
|
+
hash.push(model.up_votes_count)
|
51
|
+
hash.push(model.down_votes_count)
|
50
52
|
hash.push(model.cache_key_with_version)
|
51
53
|
hash.push(model.author.cache_key_with_version)
|
52
54
|
@hash = hash.join(Decidim.cache_key_separator)
|
@@ -137,11 +139,11 @@ module Decidim
|
|
137
139
|
end
|
138
140
|
|
139
141
|
def up_votes_count
|
140
|
-
model.
|
142
|
+
model.up_votes_count
|
141
143
|
end
|
142
144
|
|
143
145
|
def down_votes_count
|
144
|
-
model.
|
146
|
+
model.down_votes_count
|
145
147
|
end
|
146
148
|
|
147
149
|
def root_depth
|
@@ -157,11 +159,11 @@ module Decidim
|
|
157
159
|
end
|
158
160
|
|
159
161
|
def voted_up?
|
160
|
-
model.up_voted_by?(current_user)
|
162
|
+
@up_voted ||= model.up_voted_by?(current_user)
|
161
163
|
end
|
162
164
|
|
163
165
|
def voted_down?
|
164
|
-
model.down_voted_by?(current_user)
|
166
|
+
@down_voted ||= model.down_voted_by?(current_user)
|
165
167
|
end
|
166
168
|
|
167
169
|
def nested?
|
@@ -122,14 +122,14 @@ module Decidim
|
|
122
122
|
#
|
123
123
|
# Returns a bool value to indicate if the condition is truthy or not
|
124
124
|
def up_voted_by?(user)
|
125
|
-
up_votes.
|
125
|
+
up_votes.exists?(author: user)
|
126
126
|
end
|
127
127
|
|
128
128
|
# Public: Check if the user has downvoted the comment
|
129
129
|
#
|
130
130
|
# Returns a bool value to indicate if the condition is truthy or not
|
131
131
|
def down_voted_by?(user)
|
132
|
-
down_votes.
|
132
|
+
down_votes.exists?(author: user)
|
133
133
|
end
|
134
134
|
|
135
135
|
# Public: Overrides the `reported_content_url` Reportable concern method.
|
@@ -14,12 +14,22 @@ module Decidim
|
|
14
14
|
validates :weight, inclusion: { in: [-1, 1] }
|
15
15
|
validate :author_and_comment_same_organization
|
16
16
|
|
17
|
+
after_create :update_comment_votes_count
|
18
|
+
after_destroy :update_comment_votes_count
|
19
|
+
|
17
20
|
def self.export_serializer
|
18
21
|
Decidim::Comments::CommentVoteSerializer
|
19
22
|
end
|
20
23
|
|
21
24
|
private
|
22
25
|
|
26
|
+
def update_comment_votes_count
|
27
|
+
up_votes_count = self.class.where(decidim_comment_id: comment.id, weight: 1).count
|
28
|
+
down_votes_count = self.class.where(decidim_comment_id: comment.id, weight: -1).count
|
29
|
+
|
30
|
+
comment.update(up_votes_count:, down_votes_count:)
|
31
|
+
end
|
32
|
+
|
23
33
|
# Private: check if the comment and the author have the same organization
|
24
34
|
def author_and_comment_same_organization
|
25
35
|
return unless author.present? && comment.present?
|
@@ -18,8 +18,8 @@ window.Rails = Rails;
|
|
18
18
|
// Fake timers for testing polling
|
19
19
|
jest.useFakeTimers();
|
20
20
|
|
21
|
-
import { createCharacterCounter } from "
|
22
|
-
import Configuration from "
|
21
|
+
import { createCharacterCounter } from "src/decidim/input_character_counter";
|
22
|
+
import Configuration from "src/decidim/configuration";
|
23
23
|
// Component is loaded with require because using import loads it before $ has been mocked
|
24
24
|
// so tests are not able to check the spied behaviours
|
25
25
|
const CommentsComponent = require("./comments.component_for_testing.js");
|
data/config/locales/ca.yml
CHANGED
@@ -123,27 +123,27 @@ ca:
|
|
123
123
|
comments:
|
124
124
|
comment_by_followed_user:
|
125
125
|
email_intro: "%{author_name} ha deixat un comentari a %{resource_title}. Podeu llegir-lo en aquesta pàgina:"
|
126
|
-
email_outro: Has rebut aquesta notificació perquè estàs seguint %{author_name}. Pots deixar de seguir a aquesta participant des de la seva pàgina de perfil.
|
126
|
+
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.
|
127
127
|
email_subject: Hi ha un nou comentari de %{author_name} en %{resource_title}
|
128
128
|
notification_title: Hi ha un nou comentari per <a href="%{author_path}">%{author_name} %{author_nickname}</a> a <a href="%{resource_path}">%{resource_title}</a>.
|
129
129
|
comment_by_followed_user_group:
|
130
130
|
email_intro: '%{author_name} ha deixat un comentari a%{resource_title}. Pots llegir-lo en aquesta pàgina:'
|
131
|
-
email_outro: Reps aquesta notificació perquè segueixes a %{author_name}. Pots deixar de seguir aquest grup des de la seva pàgina de perfil.
|
131
|
+
email_outro: Reps aquesta notificació perquè segueixes a "%{author_name}". Pots deixar de seguir aquest grup des de la seva pàgina de perfil.
|
132
132
|
email_subject: Hi ha un nou comentari de %{author_name} en %{resource_title}
|
133
133
|
notification_title: Hi ha un nou comentari per <a href="%{author_path}">%{author_name} %{author_nickname}</a> a <a href="%{resource_path}">%{resource_title}</a>.
|
134
134
|
comment_created:
|
135
135
|
email_intro: "S'ha comentat %{resource_title}. Pots llegir el comentari d'aquesta pàgina:"
|
136
|
-
email_outro: Has rebut aquesta notificació perquè estàs seguint "%{resource_title}" o la seva autora. Pots deixar de seguir-la des de l'enllaç anterior.
|
136
|
+
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.
|
137
137
|
email_subject: Hi ha un nou comentari de %{author_name} a %{resource_title}
|
138
138
|
notification_title: Hi ha un nou comentari de <a href="%{author_path}">%{author_name} %{author_nickname}</a> en <a href="%{resource_path}">%{resource_title}</a>
|
139
139
|
comment_downvoted:
|
140
140
|
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.
|
141
|
-
email_outro: Has rebut aquesta notificació perquè
|
141
|
+
email_outro: Has rebut aquesta notificació perquè vas fer aquest comentari.
|
142
142
|
email_subject: El teu comentari a "%{resource_title}" ha rebut un vot negatiu.
|
143
143
|
notification_title: El teu <a href="%{resource_path}">comentari</a> a "%{resource_title}" ha rebut un vot negatiu. Ara té un total de %{upvotes} vots positius i %{downvotes} vots negatius.
|
144
144
|
comment_upvoted:
|
145
145
|
email_intro: El teu comentari a "%{resource_title}" ha rebut un vot positiu. Ara té un total de %{upvotes} vots positius i %{downvotes} vots negatius.
|
146
|
-
email_outro: Has rebut aquesta notificació perquè
|
146
|
+
email_outro: Has rebut aquesta notificació perquè vas fer aquest comentari.
|
147
147
|
email_subject: El teu comentari a "%{resource_title}" ha rebut un vot positiu.
|
148
148
|
notification_title: El teu <a href="%{resource_path}">comentari</a> a "%{resource_title}" ha rebut un vot positiu. Ara té un total de %{upvotes} vots positius i %{downvotes} vots negatius.
|
149
149
|
reply_created:
|
@@ -153,12 +153,12 @@ ca:
|
|
153
153
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> ha respost el teu comentari a <a href="%{resource_path}">%{resource_title}</a>
|
154
154
|
user_group_mentioned:
|
155
155
|
email_intro: Un grup al qual pertanys ha estat esmentat
|
156
|
-
email_outro: Has rebut aquesta notificació perquè formes part del grup %{group_name} que ha estat esmentat a %{resource_title}.
|
156
|
+
email_outro: Has rebut aquesta notificació perquè formes part del grup "%{group_name}" que ha estat esmentat a %{resource_title}.
|
157
157
|
email_subject: T'han esmentat a %{resource_title} com a membre de %{group_name}
|
158
158
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> t'ha esmentat com a membre de <a href="%{group_path}">%{group_name} %{group_nickname}</a> a <a href="%{resource_path}">%{resource_title}</a>
|
159
159
|
user_mentioned:
|
160
160
|
email_intro: Has estat esmentada
|
161
|
-
email_outro: Has rebut aquesta notificació perquè
|
161
|
+
email_outro: Has rebut aquesta notificació perquè t'han esmentat al comentari "%{resource_title}".
|
162
162
|
email_subject: Has estat esmentada a %{resource_title}
|
163
163
|
notification_title: Has estat esmentada a <a href="%{resource_path}">%{resource_title}</a> per <a href="%{author_path}">%{author_name} %{author_nickname}</a>
|
164
164
|
metrics:
|
data/config/locales/es.yml
CHANGED
@@ -123,7 +123,7 @@ es:
|
|
123
123
|
comments:
|
124
124
|
comment_by_followed_user:
|
125
125
|
email_intro: "%{author_name} ha dejado un comentario en %{resource_title}. Puedes leerlo en esta página:"
|
126
|
-
email_outro: Has recibido esta notificación porque sigues "%{author_name}". Puedes dejar de seguir a esta participante desde su página de perfil.
|
126
|
+
email_outro: Has recibido esta notificación porque sigues a "%{author_name}". Puedes dejar de seguir a esta participante desde su página de perfil.
|
127
127
|
email_subject: Hay un nuevo comentario de %{author_name} en %{resource_title}
|
128
128
|
notification_title: Hay un nuevo comentario de <a href="%{author_path}">%{author_name} %{author_nickname}</a> en <a href="%{resource_path}">%{resource_title}</a>.
|
129
129
|
comment_by_followed_user_group:
|
@@ -133,32 +133,32 @@ es:
|
|
133
133
|
notification_title: Hay un nuevo comentario de <a href="%{author_path}">%{author_name} %{author_nickname}</a> en <a href="%{resource_path}">%{resource_title}</a>.
|
134
134
|
comment_created:
|
135
135
|
email_intro: "%{resource_title} ha sido comentado. Puedes leer el comentario en esta página:"
|
136
|
-
email_outro: Has recibido esta notificación porque
|
136
|
+
email_outro: Has recibido esta notificación porque estás siguiendo el comentario "%{resource_title}" o a su autora. Puedes dejar de seguirla desde el enlace anterior.
|
137
137
|
email_subject: Hay un nuevo comentario de %{author_name} en %{resource_title}
|
138
138
|
notification_title: Hay un nuevo comentario de <a href="%{author_path}">%{author_name} %{author_nickname}</a> en <a href="%{resource_path}">%{resource_title}</a>
|
139
139
|
comment_downvoted:
|
140
140
|
email_intro: Tu comentario en "%{resource_title}" ha sido votado negativamente. Ahora tiene un total de %{upvotes} votos positivos y %{downvotes} votos negativos.
|
141
|
-
email_outro: Has recibido esta notificación porque
|
141
|
+
email_outro: Has recibido esta notificación porque hiciste este comentario.
|
142
142
|
email_subject: Su comentario en "%{resource_title}" ha sido votado negativamente.
|
143
143
|
notification_title: Tu <a href="%{resource_path}">comentario</a> en "%{resource_title}" ha sido votado negativamente. Ahora tiene un total de %{upvotes} votos positivos y %{downvotes} votos negativos.
|
144
144
|
comment_upvoted:
|
145
145
|
email_intro: Tu comentario en "%{resource_title}" ha sido votado postivamente. Ahora tiene un total de %{upvotes} votos positivos y %{downvotes} votos negativos.
|
146
|
-
email_outro: Has recibido esta notificación porque
|
146
|
+
email_outro: Has recibido esta notificación porque hiciste este comentario.
|
147
147
|
email_subject: Tu comentario en "%{resource_title}" ha sido votado positivamente.
|
148
148
|
notification_title: Tu <a href="%{resource_path}">comentario</a> en "%{resource_title}" ha sido votado positivamente. Ahora tiene un total de %{upvotes} votos positivos y %{downvotes} votos negativos.
|
149
149
|
reply_created:
|
150
150
|
email_intro: "%{author_name} ha respondido a tu comentario en %{resource_title}. Puedes leerlo en esta página:"
|
151
|
-
email_outro: Has recibido esta notificación porque tu comentario
|
151
|
+
email_outro: Has recibido esta notificación porque han respondido a tu comentario.
|
152
152
|
email_subject: "%{author_name} ha respondido a tu comentario en %{resource_title}"
|
153
153
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> ha respondido a tu comentario en <a href="%{resource_path}">%{resource_title}</a>
|
154
154
|
user_group_mentioned:
|
155
155
|
email_intro: Se ha mencionado un grupo al que perteneces
|
156
|
-
email_outro: Has recibido esta notificación porque formas parte del grupo %{group_name} que ha sido mencionado en %{resource_title}.
|
156
|
+
email_outro: Has recibido esta notificación porque formas parte del grupo "%{group_name}" que ha sido mencionado en "%{resource_title}".
|
157
157
|
email_subject: Te han mencionado en %{resource_title} como miembro de %{group_name}
|
158
158
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> te ha mencionado en <a href="%{resource_path}">%{resource_title}</a> como miembro de <a href="%{group_path}">%{group_name} %{group_nickname}</a>
|
159
159
|
user_mentioned:
|
160
160
|
email_intro: Has sido mencionada
|
161
|
-
email_outro: Has recibido esta notificación porque
|
161
|
+
email_outro: Has recibido esta notificación porque te han mencionado en el comentario "%{resource_title}".
|
162
162
|
email_subject: Has sido mencionada en %{resource_title}
|
163
163
|
notification_title: Has sido mencionada en <a href="%{resource_path}">%{resource_title}</a> por <a href="%{author_path}">%{author_name} %{author_nickname}</a>
|
164
164
|
metrics:
|
@@ -0,0 +1 @@
|
|
1
|
+
he:
|
data/config/locales/hu.yml
CHANGED
@@ -32,6 +32,8 @@ hu:
|
|
32
32
|
update:
|
33
33
|
error: Hiba történt a hozzászólás frissítése során.
|
34
34
|
comments_title: Hozzászólás
|
35
|
+
last_activity:
|
36
|
+
new_comment: 'Új megjegyzés:'
|
35
37
|
votes:
|
36
38
|
create:
|
37
39
|
error: Hiba történt a megjegyzésre való szavazáskor.
|
@@ -42,6 +44,8 @@ hu:
|
|
42
44
|
label: Megjegyzés
|
43
45
|
placeholder: Mit gondolsz erről?
|
44
46
|
form_error: Kötelező kitölteni, és nem lehet hosszabb, mint %{length} karakter.
|
47
|
+
submit_reply: Válasz publikálása
|
48
|
+
submit_root_comment: Megjegyzés publikálása
|
45
49
|
user_group_id:
|
46
50
|
label: 'Megjegyzés mint:'
|
47
51
|
opinion:
|
@@ -59,6 +63,7 @@ hu:
|
|
59
63
|
alignment:
|
60
64
|
against: Ellenzem
|
61
65
|
in_favor: Támogatom
|
66
|
+
cancel_reply: Válasz visszavonása
|
62
67
|
confirm_destroy: Biztosan szeretné törölni ezt a hozzászólást?
|
63
68
|
delete: Törlés
|
64
69
|
deleted_at: 'Hozzászólás törölve ekkor: %{date}'
|
data/config/locales/pl.yml
CHANGED
@@ -76,6 +76,7 @@ pl:
|
|
76
76
|
edit: Edytuj
|
77
77
|
edited: Edytowany
|
78
78
|
hide_replies: Ukryj odpowiedzi
|
79
|
+
moderated_at: Komentarz moderowany dnia %{date}
|
79
80
|
reply: Odpowiedz
|
80
81
|
report:
|
81
82
|
action: Zgłoś
|
@@ -84,6 +85,7 @@ pl:
|
|
84
85
|
description: Czy ta treść jest nieodpowiednia?
|
85
86
|
details: Dodatkowe komentarze
|
86
87
|
reasons:
|
88
|
+
does_not_belong: Zawiera nielegalną działalność, groźby samobójstwa, dane osobowe lub inne informacje, które są niestosowne w %{organization_name}.
|
87
89
|
offensive: Promuje rasizm, seksizm, nienawiść, ataki osobiste, groźby śmierci, groźby samobójcze jakąkolwiek formę mowy nienawiści.
|
88
90
|
spam: Zawiera clickbaity, reklamy, oszustwa lub skrypty botów.
|
89
91
|
title: Zgłoś niewłaściwą treść
|
data/config/locales/ro-RO.yml
CHANGED
@@ -34,6 +34,8 @@ ro:
|
|
34
34
|
update:
|
35
35
|
error: A apărut o eroare la actualizarea comentariului.
|
36
36
|
comments_title: Comentariu
|
37
|
+
last_activity:
|
38
|
+
new_comment: 'Comentariu nou:'
|
37
39
|
votes:
|
38
40
|
create:
|
39
41
|
error: A apărut o problemă la votarea comentariului.
|
@@ -45,6 +47,8 @@ ro:
|
|
45
47
|
label: Comentariu
|
46
48
|
placeholder: Ce părere ai despre asta?
|
47
49
|
form_error: Textul este obligatoriu și nu poate fi mai lung de %{length} caractere.
|
50
|
+
submit_reply: Publicați răspuns
|
51
|
+
submit_root_comment: Publicați comentariu
|
48
52
|
user_group_id:
|
49
53
|
label: Comentează în calitate de
|
50
54
|
opinion:
|
@@ -67,9 +71,9 @@ ro:
|
|
67
71
|
delete: Șterge
|
68
72
|
deleted_at: Comentariu șters la %{date}
|
69
73
|
deleted_user: Participant șters
|
70
|
-
edit:
|
71
|
-
edited:
|
72
|
-
hide_replies:
|
74
|
+
edit: Actualizare
|
75
|
+
edited: Actualizat
|
76
|
+
hide_replies: Ascundeți răspunsurile
|
73
77
|
moderated_at: Comentariu moderat pe %{date}
|
74
78
|
reply: Răspunde
|
75
79
|
report:
|
@@ -133,7 +137,7 @@ ro:
|
|
133
137
|
notification_title: Există un comentariu nou de la <a href="%{author_path}">%{author_name} %{author_nickname}</a> pentru <a href="%{resource_path}">%{resource_title}</a>.
|
134
138
|
comment_created:
|
135
139
|
email_intro: "%{resource_title} a primit un comentariu. Poți citi comentariul pe această pagină:"
|
136
|
-
email_outro:
|
140
|
+
email_outro: Ați primit această notificare deoarece urmăriți „%{resource_title}” sau pe autorii săi. Puteți anula abonarea de la link-ul anterior.
|
137
141
|
email_subject: Există un nou comentariu de la %{author_name} pentru %{resource_title}
|
138
142
|
notification_title: Există un nou comentariu de la <a href="%{author_path}">%{author_name} %{author_nickname}</a> pentru <a href="%{resource_path}">%{resource_title}</a>
|
139
143
|
comment_downvoted:
|
data/config/locales/sq-AL.yml
CHANGED
@@ -1 +1,43 @@
|
|
1
|
+
---
|
1
2
|
sq:
|
3
|
+
decidim:
|
4
|
+
components:
|
5
|
+
add_comment_form:
|
6
|
+
form:
|
7
|
+
submit_reply: Publiko përgjigje
|
8
|
+
submit_root_comment: Publiko koment
|
9
|
+
user_group_id:
|
10
|
+
label: Komento si
|
11
|
+
opinion:
|
12
|
+
label: Mendimi jot mbi këtë temë
|
13
|
+
negative: Negativ
|
14
|
+
negative_selected: Mendimi jot mbi këtë temë është negativ
|
15
|
+
neutral: Neutral
|
16
|
+
neutral_selected: Mendimi jot mbi këtë temë është neutral
|
17
|
+
positive: Pozitiv
|
18
|
+
positive_selected: Mendimi jot mbi këtë temë është pozitiv
|
19
|
+
remaining_characters: "%{count} karaktere të mbetura"
|
20
|
+
remaining_characters_1: "%{count} karakter i mbetur"
|
21
|
+
title: Shto komentin tënd
|
22
|
+
comment:
|
23
|
+
alignment:
|
24
|
+
against: Kundër
|
25
|
+
in_favor: Pro
|
26
|
+
cancel_reply: Anullo përgjigje
|
27
|
+
confirm_destroy: A je i sigurt që do ta fshish këtë koment?
|
28
|
+
delete: Fshi
|
29
|
+
deleted_at: Komenti u fshi në datën %{date}
|
30
|
+
edit: Përpuno
|
31
|
+
edited: Ndryshuar
|
32
|
+
hide_replies: Fshih përgjigjet
|
33
|
+
moderated_at: Komenti u moderua në datën %{date}
|
34
|
+
reply: Përgjigju
|
35
|
+
report:
|
36
|
+
action: Raporto
|
37
|
+
already_reported: Kjo përmbajtje është raportuar nga të tjerë dhe do rishikohet nga administratorët.
|
38
|
+
close: Mbyll
|
39
|
+
description: Përmbajtje e papërshtatshme?
|
40
|
+
details: Komente të tjera
|
41
|
+
reasons:
|
42
|
+
does_not_belong: Përmban aktivitete të paligjshme, kërcënime për vetëvrasje, informacion personal apo diçka tjetër që mendon se nuk i përket %{organization_name}.
|
43
|
+
offensive: Përmban racizëm, seksizëm, ofendime, sulme personale, kërcënime me vdekje, shtyrje për vetëvrasje apo forma të tjera të gjuhës së urrejtjes.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddCommentVoteCounterCacheToComments < ActiveRecord::Migration[6.1]
|
4
|
+
def change
|
5
|
+
add_column :decidim_comments_comments, :up_votes_count, :integer, null: false, default: 0, index: true
|
6
|
+
add_column :decidim_comments_comments, :down_votes_count, :integer, null: false, default: 0, index: true
|
7
|
+
|
8
|
+
# We cannot use the reset_counters as up_votes and down_votes are scoped associationws
|
9
|
+
reversible do |dir|
|
10
|
+
dir.up do
|
11
|
+
Decidim::Comments::Comment.reset_column_information
|
12
|
+
Decidim::Comments::Comment.find_each do |record|
|
13
|
+
# rubocop:disable Rails/SkipsModelValidations
|
14
|
+
record.class.update_counters(record.id, up_votes_count: record.up_votes.length)
|
15
|
+
record.class.update_counters(record.id, down_votes_count: record.down_votes.length)
|
16
|
+
# rubocop:enable Rails/SkipsModelValidations
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
4
|
+
|
5
|
+
# Maintain your gem's version:
|
6
|
+
require "decidim/comments/version"
|
7
|
+
|
8
|
+
# Describe your gem and declare its dependencies:
|
9
|
+
Gem::Specification.new do |s|
|
10
|
+
s.version = Decidim::Comments.version
|
11
|
+
s.authors = ["Josep Jaume Rey Peroy", "Marc Riera Casals", "Oriol Gual Oliva"]
|
12
|
+
s.email = ["josepjaume@gmail.com", "mrc2407@gmail.com", "oriolgual@gmail.com"]
|
13
|
+
s.license = "AGPL-3.0"
|
14
|
+
s.homepage = "https://decidim.org"
|
15
|
+
s.metadata = {
|
16
|
+
"bug_tracker_uri" => "https://github.com/decidim/decidim/issues",
|
17
|
+
"documentation_uri" => "https://docs.decidim.org/",
|
18
|
+
"funding_uri" => "https://opencollective.com/decidim",
|
19
|
+
"homepage_uri" => "https://decidim.org",
|
20
|
+
"source_code_uri" => "https://github.com/decidim/decidim"
|
21
|
+
}
|
22
|
+
s.required_ruby_version = "~> 3.1.0"
|
23
|
+
|
24
|
+
s.name = "decidim-comments"
|
25
|
+
s.summary = "Decidim comments module"
|
26
|
+
s.description = "Pluggable comments system for some components."
|
27
|
+
|
28
|
+
s.files = Dir.chdir(__dir__) do
|
29
|
+
`git ls-files -z`.split("\x0").select do |f|
|
30
|
+
(File.expand_path(f) == __FILE__) ||
|
31
|
+
f.start_with?(*%w(app/ config/ db/ lib/ Rakefile README.md))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
s.add_dependency "decidim-core", Decidim::Comments.version
|
36
|
+
s.add_dependency "redcarpet", "~> 3.5", ">= 3.5.1"
|
37
|
+
|
38
|
+
s.add_development_dependency "decidim-admin", Decidim::Comments.version
|
39
|
+
s.add_development_dependency "decidim-dev", Decidim::Comments.version
|
40
|
+
end
|
@@ -58,7 +58,7 @@ module Decidim
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def up_votes
|
61
|
-
object.
|
61
|
+
object.up_votes_count
|
62
62
|
end
|
63
63
|
|
64
64
|
def up_voted
|
@@ -66,7 +66,7 @@ module Decidim
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def down_votes
|
69
|
-
object.
|
69
|
+
object.down_votes_count
|
70
70
|
end
|
71
71
|
|
72
72
|
def down_voted
|
@@ -4,8 +4,11 @@ require "decidim/core/test/factories"
|
|
4
4
|
|
5
5
|
FactoryBot.define do
|
6
6
|
factory :comment, class: "Decidim::Comments::Comment" do
|
7
|
-
|
8
|
-
|
7
|
+
transient do
|
8
|
+
skip_injection { false }
|
9
|
+
end
|
10
|
+
author { build(:user, organization: commentable.organization, skip_injection:) }
|
11
|
+
commentable { build(:dummy_resource, skip_injection:) }
|
9
12
|
root_commentable { commentable }
|
10
13
|
body { Decidim::Faker::Localized.paragraph }
|
11
14
|
participatory_space { commentable.try(:participatory_space) }
|
@@ -25,22 +28,26 @@ FactoryBot.define do
|
|
25
28
|
end
|
26
29
|
|
27
30
|
trait :comment_on_comment do
|
28
|
-
author { build(:user, organization: root_commentable.organization) }
|
31
|
+
author { build(:user, organization: root_commentable.organization, skip_injection:) }
|
29
32
|
commentable do
|
30
33
|
build(
|
31
34
|
:comment,
|
32
35
|
author:,
|
33
36
|
root_commentable:,
|
34
|
-
commentable: root_commentable
|
37
|
+
commentable: root_commentable,
|
38
|
+
skip_injection:
|
35
39
|
)
|
36
40
|
end
|
37
|
-
root_commentable { build(:dummy_resource) }
|
41
|
+
root_commentable { build(:dummy_resource, skip_injection:) }
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
41
45
|
factory :comment_vote, class: "Decidim::Comments::CommentVote" do
|
42
|
-
|
43
|
-
|
46
|
+
transient do
|
47
|
+
skip_injection { false }
|
48
|
+
end
|
49
|
+
comment { build(:comment, skip_injection:) }
|
50
|
+
author { build(:user, organization: comment.organization, skip_injection:) }
|
44
51
|
weight { [-1, 1].sample }
|
45
52
|
|
46
53
|
trait :up_vote do
|
@@ -16,7 +16,7 @@ shared_context "when it is a comment event" do
|
|
16
16
|
let(:comment_author_name) { decidim_html_escape comment.author.name }
|
17
17
|
|
18
18
|
let(:extra) { { comment_id: comment.id } }
|
19
|
-
let(:resource_title) {
|
19
|
+
let(:resource_title) { decidim_sanitize_translated(resource.title) }
|
20
20
|
let(:user_group) do
|
21
21
|
user_group = create(:user_group, :verified, organization:, users: [comment_author])
|
22
22
|
comment.update!(user_group:)
|
@@ -12,7 +12,7 @@ shared_examples_for "a comment voted event" do
|
|
12
12
|
let(:comment_vote_author) { comment_vote.author }
|
13
13
|
|
14
14
|
let(:extra) { { comment_id: comment.id, author_id: comment_vote_author.id, weight:, downvotes: 100, upvotes: 999 } }
|
15
|
-
let(:resource_title) {
|
15
|
+
let(:resource_title) { decidim_sanitize_translated(resource.title) }
|
16
16
|
let(:resource_text) { subject.resource_text }
|
17
17
|
|
18
18
|
let(:verb) { weight.positive? ? "upvoted" : "downvoted" }
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-comments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.28.
|
4
|
+
version: 0.28.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
8
8
|
- Marc Riera Casals
|
9
9
|
- Oriol Gual Oliva
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-04-30 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.28.
|
21
|
+
version: 0.28.1
|
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.
|
28
|
+
version: 0.28.1
|
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.28.
|
55
|
+
version: 0.28.1
|
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.28.
|
62
|
+
version: 0.28.1
|
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.28.
|
69
|
+
version: 0.28.1
|
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.28.
|
76
|
+
version: 0.28.1
|
77
77
|
description: Pluggable comments system for some components.
|
78
78
|
email:
|
79
79
|
- josepjaume@gmail.com
|
@@ -168,7 +168,6 @@ files:
|
|
168
168
|
- app/views/decidim/comments/votes/create.js.erb
|
169
169
|
- app/views/decidim/comments/votes/error.js.erb
|
170
170
|
- config/assets.rb
|
171
|
-
- config/environment.rb
|
172
171
|
- config/locales/am-ET.yml
|
173
172
|
- config/locales/ar-SA.yml
|
174
173
|
- config/locales/ar.yml
|
@@ -201,6 +200,7 @@ files:
|
|
201
200
|
- config/locales/ga-IE.yml
|
202
201
|
- config/locales/gl.yml
|
203
202
|
- config/locales/gn-PY.yml
|
203
|
+
- config/locales/he-IL.yml
|
204
204
|
- config/locales/hr-HR.yml
|
205
205
|
- config/locales/hr.yml
|
206
206
|
- config/locales/hu.yml
|
@@ -264,7 +264,9 @@ files:
|
|
264
264
|
- db/migrate/20200828101910_add_commentable_counter_cache_to_comments.rb
|
265
265
|
- db/migrate/20210402124534_add_participatory_process_to_comments.rb
|
266
266
|
- db/migrate/20210529095942_add_deleted_at_column_to_comments.rb
|
267
|
+
- db/migrate/20240304092558_add_comment_vote_counter_cache_to_comments.rb
|
267
268
|
- db/seeds.rb
|
269
|
+
- decidim-comments.gemspec
|
268
270
|
- lib/decidim/api/add_comment_type.rb
|
269
271
|
- lib/decidim/api/comment_mutation_type.rb
|
270
272
|
- lib/decidim/api/comment_type.rb
|
@@ -304,23 +306,23 @@ metadata:
|
|
304
306
|
funding_uri: https://opencollective.com/decidim
|
305
307
|
homepage_uri: https://decidim.org
|
306
308
|
source_code_uri: https://github.com/decidim/decidim
|
307
|
-
post_install_message:
|
309
|
+
post_install_message:
|
308
310
|
rdoc_options: []
|
309
311
|
require_paths:
|
310
312
|
- lib
|
311
313
|
required_ruby_version: !ruby/object:Gem::Requirement
|
312
314
|
requirements:
|
313
|
-
- - "
|
315
|
+
- - "~>"
|
314
316
|
- !ruby/object:Gem::Version
|
315
|
-
version:
|
317
|
+
version: 3.1.0
|
316
318
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
317
319
|
requirements:
|
318
320
|
- - ">="
|
319
321
|
- !ruby/object:Gem::Version
|
320
322
|
version: '0'
|
321
323
|
requirements: []
|
322
|
-
rubygems_version: 3.
|
323
|
-
signing_key:
|
324
|
+
rubygems_version: 3.5.9
|
325
|
+
signing_key:
|
324
326
|
specification_version: 4
|
325
327
|
summary: Decidim comments module
|
326
328
|
test_files: []
|
data/config/environment.rb
DELETED