decidim-comments 0.27.5 → 0.27.6

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: f9358ab00be362546c8204c5b2ffc107f1d710fdf0cbabdc87b2bbd3b43d9391
4
- data.tar.gz: 651e755e4d6d217445f3ea245ccccdde990fe47d5e8f965a61716c5d2a7c9ba9
3
+ metadata.gz: 818d04b7eefe94a674bd210a31011829ba09e6df1059695a345a2046b4147d70
4
+ data.tar.gz: 5de4aa55452b6912385a483e92295bcc0a713141485b43a9d97c6bac51a22065
5
5
  SHA512:
6
- metadata.gz: a4d11d18533c35dc3b3844db27eb5dede7ee92174fae244f11ec581c5546afb61927a936976fd9c75db349662a3e11112fd730fd01dfd0e96af1a1d3828b139b
7
- data.tar.gz: 711efd02fb29aa17f83c50ad16f8913d252402907ef12355d6db63fddfbd72102f2f292b96b545e3f3b15049b5e5e71d50271ec0719538eb316989ce593f4df9
6
+ metadata.gz: 867ee377607aad693860a83d7a92d4fc3147e43ffbbcdf5c7c5c49d7ba53d65b9d4614d9ecbec287cde1d05c9aea577a707238745b0aa65327874625d9a2a91a
7
+ data.tar.gz: 5718f8b9a21de23c12d0727a633859d2a6daf4a76a727115b9bae2f20f73a3de52fd417a6c348ec4f6eeff7611b2abba41c9a18152130e0d94034a8c6b4023bc
@@ -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)
@@ -146,11 +148,11 @@ module Decidim
146
148
  end
147
149
 
148
150
  def up_votes_count
149
- model.up_votes.count
151
+ model.up_votes_count
150
152
  end
151
153
 
152
154
  def down_votes_count
153
- model.down_votes.count
155
+ model.down_votes_count
154
156
  end
155
157
 
156
158
  def root_depth
@@ -166,11 +168,11 @@ module Decidim
166
168
  end
167
169
 
168
170
  def voted_up?
169
- model.up_voted_by?(current_user)
171
+ @up_voted ||= model.up_voted_by?(current_user)
170
172
  end
171
173
 
172
174
  def voted_down?
173
- model.down_voted_by?(current_user)
175
+ @down_voted ||= model.down_voted_by?(current_user)
174
176
  end
175
177
 
176
178
  def nested?
@@ -29,6 +29,7 @@ module Decidim
29
29
  translatable_fields :body
30
30
 
31
31
  parent_item_foreign_key :decidim_commentable_id
32
+ parent_item_polymorphic_type_key :decidim_commentable_type
32
33
 
33
34
  belongs_to :commentable, foreign_key: "decidim_commentable_id", foreign_type: "decidim_commentable_type", polymorphic: true
34
35
  belongs_to :root_commentable, foreign_key: "decidim_root_commentable_id", foreign_type: "decidim_root_commentable_type", polymorphic: true, touch: true
@@ -121,14 +122,14 @@ module Decidim
121
122
  #
122
123
  # Returns a bool value to indicate if the condition is truthy or not
123
124
  def up_voted_by?(user)
124
- up_votes.any? { |vote| vote.author == user }
125
+ up_votes.exists?(author: user)
125
126
  end
126
127
 
127
128
  # Public: Check if the user has downvoted the comment
128
129
  #
129
130
  # Returns a bool value to indicate if the condition is truthy or not
130
131
  def down_voted_by?(user)
131
- down_votes.any? { |vote| vote.author == user }
132
+ down_votes.exists?(author: user)
132
133
  end
133
134
 
134
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: up_votes_count, down_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?
@@ -5,3 +5,26 @@ bg:
5
5
  decidim/comments/comment_by_followed_user_event: Коментар
6
6
  decidim/comments/comment_created_event: Коментар
7
7
  decidim/comments/reply_created_event: Отговор на коментар
8
+ decidim:
9
+ comments:
10
+ comments:
11
+ delete:
12
+ error: Коментарът не можа да бъде изтрит.
13
+ comments_count: Брой коментари
14
+ last_activity:
15
+ new_comment_at_html: "<span>Нов коментар на %{link}</span>"
16
+ view: Преглед
17
+ components:
18
+ add_comment_form:
19
+ account_message: <a href="%{sign_in_url}">Влезте с Вашия профил</a> или <a href="%{sign_up_url}">се регистрирайте</a>, за да добавите коментара си.
20
+ form:
21
+ form_error: Текстът е задължителен и не може да е по-дълъг от %{length} символа.
22
+ comment:
23
+ report:
24
+ reasons:
25
+ does_not_belong: Съдържа незаконни дейности, заплахи за самоубийство, лична информация или нещо друго, което считате, че е неподходящо за %{organization_name}.
26
+ comment_thread:
27
+ title: Разговор с %{authorName}
28
+ errors:
29
+ messages:
30
+ cannot_have_comments: не може да има коментари
@@ -125,27 +125,27 @@ ca:
125
125
  comments:
126
126
  comment_by_followed_user:
127
127
  email_intro: "%{author_name} ha deixat un comentari a %{resource_title}. Podeu llegir-lo en aquesta pàgina:"
128
- 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.
128
+ 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.
129
129
  email_subject: Hi ha un nou comentari de %{author_name} en %{resource_title}
130
130
  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>.
131
131
  comment_by_followed_user_group:
132
132
  email_intro: '%{author_name} ha deixat un comentari a%{resource_title}. Pots llegir-lo en aquesta pàgina:'
133
- email_outro: Reps aquesta notificació perquè segueixes a %{author_name}. Pots deixar de seguir aquest grup des de la seva pàgina de perfil.
133
+ email_outro: Reps aquesta notificació perquè segueixes a "%{author_name}". Pots deixar de seguir aquest grup des de la seva pàgina de perfil.
134
134
  email_subject: Hi ha un nou comentari de %{author_name} en %{resource_title}
135
135
  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>.
136
136
  comment_created:
137
137
  email_intro: "S'ha comentat %{resource_title}. Pots llegir el comentari d'aquesta pàgina:"
138
- 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.
138
+ 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.
139
139
  email_subject: Hi ha un nou comentari de %{author_name} a %{resource_title}
140
140
  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>
141
141
  comment_downvoted:
142
142
  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.
143
- email_outro: Has rebut aquesta notificació perquè ets autora d'aquest comentari.
143
+ email_outro: Has rebut aquesta notificació perquè vas fer aquest comentari.
144
144
  email_subject: El teu comentari a "%{resource_title}" ha rebut un vot negatiu.
145
145
  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.
146
146
  comment_upvoted:
147
147
  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.
148
- email_outro: Has rebut aquesta notificació perquè ets autora d'aquest comentari.
148
+ email_outro: Has rebut aquesta notificació perquè vas fer aquest comentari.
149
149
  email_subject: El teu comentari a "%{resource_title}" ha rebut un vot positiu.
150
150
  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.
151
151
  reply_created:
@@ -155,12 +155,12 @@ ca:
155
155
  notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> ha respost el teu comentari a <a href="%{resource_path}">%{resource_title}</a>
156
156
  user_group_mentioned:
157
157
  email_intro: Un grup al qual pertanys ha estat esmentat
158
- email_outro: Has rebut aquesta notificació perquè formes part del grup %{group_name} que ha estat esmentat a %{resource_title}.
158
+ email_outro: Has rebut aquesta notificació perquè formes part del grup "%{group_name}" que ha estat esmentat a %{resource_title}.
159
159
  email_subject: T'han esmentat a %{resource_title} com a membre de %{group_name}
160
160
  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>
161
161
  user_mentioned:
162
162
  email_intro: Has estat esmentada
163
- email_outro: Has rebut aquesta notificació perquè has estat esmentada a %{resource_title}.
163
+ email_outro: Has rebut aquesta notificació perquè t'han esmentat al comentari "%{resource_title}".
164
164
  email_subject: Has estat esmentada a %{resource_title}
165
165
  notification_title: Has estat esmentada a <a href="%{resource_path}">%{resource_title}</a> per <a href="%{author_path}">%{author_name} %{author_nickname}</a>
166
166
  metrics:
@@ -125,7 +125,7 @@ es:
125
125
  comments:
126
126
  comment_by_followed_user:
127
127
  email_intro: "%{author_name} ha dejado un comentario en %{resource_title}. Puedes leerlo en esta página:"
128
- email_outro: Has recibido esta notificación porque sigues "%{author_name}". Puedes dejar de seguir a esta participante desde su página de perfil.
128
+ 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.
129
129
  email_subject: Hay un nuevo comentario de %{author_name} en %{resource_title}
130
130
  notification_title: Hay un nuevo comentario de <a href="%{author_path}">%{author_name} %{author_nickname}</a> en <a href="%{resource_path}">%{resource_title}</a>.
131
131
  comment_by_followed_user_group:
@@ -135,32 +135,32 @@ es:
135
135
  notification_title: Hay un nuevo comentario de <a href="%{author_path}">%{author_name} %{author_nickname}</a> en <a href="%{resource_path}">%{resource_title}</a>.
136
136
  comment_created:
137
137
  email_intro: "%{resource_title} ha sido comentado. Puedes leer el comentario en esta página:"
138
- email_outro: Has recibido esta notificación porque está siguiendo "%{resource_title}" o su autora. Puedes dejar de seguirla desde el enlace anterior.
138
+ 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.
139
139
  email_subject: Hay un nuevo comentario de %{author_name} en %{resource_title}
140
140
  notification_title: Hay un nuevo comentario de <a href="%{author_path}">%{author_name} %{author_nickname}</a> en <a href="%{resource_path}">%{resource_title}</a>
141
141
  comment_downvoted:
142
142
  email_intro: Tu comentario en "%{resource_title}" ha sido votado negativamente. Ahora tiene un total de %{upvotes} votos positivos y %{downvotes} votos negativos.
143
- email_outro: Has recibido esta notificación porque eres la autora de este comentario.
143
+ email_outro: Has recibido esta notificación porque hiciste este comentario.
144
144
  email_subject: Su comentario en "%{resource_title}" ha sido votado negativamente.
145
145
  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.
146
146
  comment_upvoted:
147
147
  email_intro: Tu comentario en "%{resource_title}" ha sido votado postivamente. Ahora tiene un total de %{upvotes} votos positivos y %{downvotes} votos negativos.
148
- email_outro: Has recibido esta notificación porque eres la autora de este comentario.
148
+ email_outro: Has recibido esta notificación porque hiciste este comentario.
149
149
  email_subject: Tu comentario en "%{resource_title}" ha sido votado positivamente.
150
150
  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.
151
151
  reply_created:
152
152
  email_intro: "%{author_name} ha respondido a tu comentario en %{resource_title}. Puedes leerlo en esta página:"
153
- email_outro: Has recibido esta notificación porque tu comentario fue respondido.
153
+ email_outro: Has recibido esta notificación porque han respondido a tu comentario.
154
154
  email_subject: "%{author_name} ha respondido a tu comentario en %{resource_title}"
155
155
  notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> ha respondido a tu comentario en <a href="%{resource_path}">%{resource_title}</a>
156
156
  user_group_mentioned:
157
157
  email_intro: Se ha mencionado un grupo al que perteneces
158
- email_outro: Has recibido esta notificación porque formas parte del grupo %{group_name} que ha sido mencionado en %{resource_title}.
158
+ email_outro: Has recibido esta notificación porque formas parte del grupo "%{group_name}" que ha sido mencionado en "%{resource_title}".
159
159
  email_subject: Te han mencionado en %{resource_title} como miembro de %{group_name}
160
160
  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>
161
161
  user_mentioned:
162
162
  email_intro: Has sido mencionada
163
- email_outro: Has recibido esta notificación porque has sido mencionada en %{resource_title}.
163
+ email_outro: Has recibido esta notificación porque te han mencionado en el comentario "%{resource_title}".
164
164
  email_subject: Has sido mencionada en %{resource_title}
165
165
  notification_title: Has sido mencionada en <a href="%{resource_path}">%{resource_title}</a> por <a href="%{author_path}">%{author_name} %{author_nickname}</a>
166
166
  metrics:
@@ -0,0 +1 @@
1
+ he:
@@ -27,6 +27,8 @@ hu:
27
27
  comments:
28
28
  create:
29
29
  error: Hiba történt a hozzászólás létrehozása során.
30
+ delete:
31
+ error: A hozzászólás nem törölhető.
30
32
  update:
31
33
  error: Hiba történt a hozzászólás frissítése során.
32
34
  comments_count: Hozzászólások száma
@@ -45,7 +47,7 @@ hu:
45
47
  label: Megjegyzés
46
48
  placeholder: Mit gondolsz erről?
47
49
  form_error: Kötelező kitölteni, és nem lehet hosszabb, mint %{length} karakter.
48
- submit: Elküld
50
+ submit: Küldés
49
51
  user_group_id:
50
52
  label: 'Megjegyzés mint:'
51
53
  opinion:
@@ -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ś
@@ -71,9 +71,9 @@ ro:
71
71
  delete: Șterge
72
72
  deleted_at: Comentariu șters la %{date}
73
73
  deleted_user: Participant șters
74
- edit: Editează
75
- edited: Editat
76
- hide_replies: Ascunde răspunsurile
74
+ edit: Actualizare
75
+ edited: Actualizat
76
+ hide_replies: Ascundeți răspunsurile
77
77
  moderated_at: Comentariu moderat pe %{date}
78
78
  reply: Răspunde
79
79
  report:
@@ -139,7 +139,7 @@ ro:
139
139
  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>.
140
140
  comment_created:
141
141
  email_intro: "%{resource_title} a primit un comentariu. Poți citi comentariul pe această pagină:"
142
- email_outro: Ai primit această notificare deoarece urmărești „%{resource_title}” sau pe autorii săi. Poți anula abonarea de la link-ul anterior.
142
+ 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.
143
143
  email_subject: Există un nou comentariu de la %{author_name} pentru %{resource_title}
144
144
  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>
145
145
  comment_downvoted:
@@ -1 +1,39 @@
1
+ ---
1
2
  sq:
3
+ decidim:
4
+ components:
5
+ add_comment_form:
6
+ form:
7
+ user_group_id:
8
+ label: Komento si
9
+ opinion:
10
+ label: Mendimi jot mbi këtë temë
11
+ negative: Negativ
12
+ negative_selected: Mendimi jot mbi këtë temë është negativ
13
+ neutral: Neutral
14
+ neutral_selected: Mendimi jot mbi këtë temë është neutral
15
+ positive: Pozitiv
16
+ positive_selected: Mendimi jot mbi këtë temë është pozitiv
17
+ remaining_characters: "%{count} karaktere të mbetura"
18
+ remaining_characters_1: "%{count} karakter i mbetur"
19
+ title: Shto komentin tënd
20
+ comment:
21
+ alignment:
22
+ against: Kundër
23
+ in_favor: Pro
24
+ confirm_destroy: A je i sigurt që do ta fshish këtë koment?
25
+ delete: Fshi
26
+ deleted_at: Komenti u fshi në datën %{date}
27
+ edit: Përpuno
28
+ edited: Ndryshuar
29
+ hide_replies: Fshih përgjigjet
30
+ moderated_at: Komenti u moderua në datën %{date}
31
+ reply: Përgjigju
32
+ report:
33
+ action: Raporto
34
+ already_reported: Kjo përmbajtje është raportuar nga të tjerë dhe do rishikohet nga administratorët.
35
+ close: Mbyll
36
+ description: Përmbajtje e papërshtatshme?
37
+ details: Komente të tjera
38
+ reasons:
39
+ 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,33 @@
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://github.com/decidim/decidim"
15
+ s.required_ruby_version = "~> 3.0.0"
16
+
17
+ s.name = "decidim-comments"
18
+ s.summary = "Decidim comments module"
19
+ s.description = "Pluggable comments system for some components."
20
+
21
+ s.files = Dir.chdir(__dir__) do
22
+ `git ls-files -z`.split("\x0").select do |f|
23
+ (File.expand_path(f) == __FILE__) ||
24
+ f.start_with?(*%w(app/ config/ db/ lib/ Rakefile README.md))
25
+ end
26
+ end
27
+
28
+ s.add_dependency "decidim-core", Decidim::Comments.version
29
+ s.add_dependency "redcarpet", "~> 3.5", ">= 3.5.1"
30
+
31
+ s.add_development_dependency "decidim-admin", Decidim::Comments.version
32
+ s.add_development_dependency "decidim-dev", Decidim::Comments.version
33
+ end
@@ -58,7 +58,7 @@ module Decidim
58
58
  end
59
59
 
60
60
  def up_votes
61
- object.up_votes.size
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.down_votes.size
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
- author { build(:user, organization: commentable.organization) }
8
- commentable { build(:dummy_resource) }
7
+ transient do
8
+ skip_injection { false }
9
+ end
10
+ author { build(:user, organization: commentable.organization, skip_injection: skip_injection) }
11
+ commentable { build(:dummy_resource, skip_injection: 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: skip_injection) }
29
32
  commentable do
30
33
  build(
31
34
  :comment,
32
35
  author: author,
33
36
  root_commentable: root_commentable,
34
- commentable: root_commentable
37
+ commentable: root_commentable,
38
+ skip_injection: skip_injection
35
39
  )
36
40
  end
37
- root_commentable { build(:dummy_resource) }
41
+ root_commentable { build(:dummy_resource, skip_injection: skip_injection) }
38
42
  end
39
43
  end
40
44
 
41
45
  factory :comment_vote, class: "Decidim::Comments::CommentVote" do
42
- comment { build(:comment) }
43
- author { build(:user, organization: comment.organization) }
46
+ transient do
47
+ skip_injection { false }
48
+ end
49
+ comment { build(:comment, skip_injection: skip_injection) }
50
+ author { build(:user, organization: comment.organization, skip_injection: skip_injection) }
44
51
  weight { [-1, 1].sample }
45
52
 
46
53
  trait :up_vote do
@@ -16,7 +16,7 @@ shared_context "when it's 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) { decidim_html_escape(translated(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: organization, users: [comment_author])
22
22
  comment.update!(user_group: 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: weight, downvotes: 100, upvotes: 999 } }
15
- let(:resource_title) { decidim_html_escape(translated(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" }
@@ -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.27.5"
7
+ "0.27.6"
8
8
  end
9
9
  end
10
10
  end
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.27.5
4
+ version: 0.27.6
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: 2023-12-20 00:00:00.000000000 Z
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.27.5
21
+ version: 0.27.6
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.27.5
28
+ version: 0.27.6
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: redcarpet
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -52,28 +52,28 @@ dependencies:
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 0.27.5
55
+ version: 0.27.6
56
56
  type: :development
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 0.27.5
62
+ version: 0.27.6
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: decidim-dev
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 0.27.5
69
+ version: 0.27.6
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 0.27.5
76
+ version: 0.27.6
77
77
  description: Pluggable comments system for some components.
78
78
  email:
79
79
  - josepjaume@gmail.com
@@ -167,7 +167,6 @@ files:
167
167
  - app/views/decidim/comments/votes/create.js.erb
168
168
  - app/views/decidim/comments/votes/error.js.erb
169
169
  - config/assets.rb
170
- - config/environment.rb
171
170
  - config/locales/am-ET.yml
172
171
  - config/locales/ar-SA.yml
173
172
  - config/locales/ar.yml
@@ -200,6 +199,7 @@ files:
200
199
  - config/locales/ga-IE.yml
201
200
  - config/locales/gl.yml
202
201
  - config/locales/gn-PY.yml
202
+ - config/locales/he-IL.yml
203
203
  - config/locales/hr-HR.yml
204
204
  - config/locales/hr.yml
205
205
  - config/locales/hu.yml
@@ -263,7 +263,9 @@ files:
263
263
  - db/migrate/20200828101910_add_commentable_counter_cache_to_comments.rb
264
264
  - db/migrate/20210402124534_add_participatory_process_to_comments.rb
265
265
  - db/migrate/20210529095942_add_deleted_at_column_to_comments.rb
266
+ - db/migrate/20240304092558_add_comment_vote_counter_cache_to_comments.rb
266
267
  - db/seeds.rb
268
+ - decidim-comments.gemspec
267
269
  - lib/decidim/api/add_comment_type.rb
268
270
  - lib/decidim/api/comment_mutation_type.rb
269
271
  - lib/decidim/api/comment_type.rb
@@ -298,23 +300,23 @@ homepage: https://github.com/decidim/decidim
298
300
  licenses:
299
301
  - AGPL-3.0
300
302
  metadata: {}
301
- post_install_message:
303
+ post_install_message:
302
304
  rdoc_options: []
303
305
  require_paths:
304
306
  - lib
305
307
  required_ruby_version: !ruby/object:Gem::Requirement
306
308
  requirements:
307
- - - ">="
309
+ - - "~>"
308
310
  - !ruby/object:Gem::Version
309
- version: '3.0'
311
+ version: 3.0.0
310
312
  required_rubygems_version: !ruby/object:Gem::Requirement
311
313
  requirements:
312
314
  - - ">="
313
315
  - !ruby/object:Gem::Version
314
316
  version: '0'
315
317
  requirements: []
316
- rubygems_version: 3.4.22
317
- signing_key:
318
+ rubygems_version: 3.2.22
319
+ signing_key:
318
320
  specification_version: 4
319
321
  summary: Decidim comments module
320
322
  test_files: []
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Empty line for playing nice with tpope/vim-rails