decidim-comments 0.26.2 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/comments/comment_cell.rb +2 -2
  3. data/app/cells/decidim/comments/comments/comments_loading.erb +3 -0
  4. data/app/cells/decidim/comments/comments/show.erb +1 -0
  5. data/app/cells/decidim/comments/comments_cell.rb +7 -12
  6. data/app/commands/decidim/comments/create_comment.rb +1 -1
  7. data/app/commands/decidim/comments/delete_comment.rb +1 -1
  8. data/app/commands/decidim/comments/update_comment.rb +1 -1
  9. data/app/commands/decidim/comments/vote_comment.rb +1 -1
  10. data/app/controllers/decidim/comments/comments_controller.rb +13 -9
  11. data/app/helpers/decidim/comments/comment_cells_helper.rb +1 -1
  12. data/app/models/decidim/comments/comment.rb +7 -4
  13. data/app/models/decidim/comments/comment_vote.rb +1 -1
  14. data/app/packs/src/decidim/comments/comments.component.js +32 -13
  15. data/app/packs/src/decidim/comments/comments.component.test.js +9 -5
  16. data/app/permissions/decidim/comments/permissions.rb +5 -7
  17. data/app/queries/decidim/comments/sorted_comments.rb +1 -3
  18. data/app/services/decidim/comments/new_comment_notification_creator.rb +1 -1
  19. data/app/views/decidim/comments/comments/index.js.erb +1 -0
  20. data/app/views/decidim/comments/comments/reload.js.erb +1 -0
  21. data/config/locales/am-ET.yml +1 -0
  22. data/config/locales/ar.yml +1 -0
  23. data/config/locales/bg.yml +1 -0
  24. data/config/locales/ca.yml +1 -0
  25. data/config/locales/cs.yml +1 -0
  26. data/config/locales/da.yml +1 -0
  27. data/config/locales/de.yml +1 -0
  28. data/config/locales/el.yml +1 -0
  29. data/config/locales/eo.yml +1 -0
  30. data/config/locales/es-MX.yml +1 -0
  31. data/config/locales/es-PY.yml +1 -0
  32. data/config/locales/es.yml +1 -0
  33. data/config/locales/et.yml +1 -0
  34. data/config/locales/eu.yml +1 -0
  35. data/config/locales/fi-plain.yml +1 -0
  36. data/config/locales/fi.yml +1 -0
  37. data/config/locales/fr-CA.yml +1 -0
  38. data/config/locales/fr.yml +1 -0
  39. data/config/locales/ga-IE.yml +1 -0
  40. data/config/locales/gl.yml +1 -0
  41. data/config/locales/hr.yml +1 -0
  42. data/config/locales/hu.yml +1 -0
  43. data/config/locales/id-ID.yml +1 -0
  44. data/config/locales/is-IS.yml +2 -1
  45. data/config/locales/it.yml +1 -0
  46. data/config/locales/ja.yml +1 -0
  47. data/config/locales/ko.yml +1 -0
  48. data/config/locales/lb.yml +1 -0
  49. data/config/locales/lt.yml +1 -0
  50. data/config/locales/lv.yml +1 -0
  51. data/config/locales/mt.yml +1 -0
  52. data/config/locales/nl.yml +1 -0
  53. data/config/locales/no.yml +1 -0
  54. data/config/locales/om-ET.yml +1 -0
  55. data/config/locales/pl.yml +1 -0
  56. data/config/locales/pt-BR.yml +2 -1
  57. data/config/locales/pt.yml +1 -0
  58. data/config/locales/ro-RO.yml +1 -0
  59. data/config/locales/ru.yml +1 -0
  60. data/config/locales/si-LK.yml +1 -0
  61. data/config/locales/sk.yml +1 -0
  62. data/config/locales/sl.yml +1 -0
  63. data/config/locales/so-SO.yml +1 -0
  64. data/config/locales/sr-CS.yml +1 -0
  65. data/config/locales/sv.yml +1 -0
  66. data/config/locales/sw-KE.yml +1 -0
  67. data/config/locales/ti-ER.yml +1 -0
  68. data/config/locales/tr-TR.yml +1 -0
  69. data/config/locales/uk.yml +1 -0
  70. data/config/locales/val-ES.yml +1 -0
  71. data/config/locales/vi.yml +1 -0
  72. data/config/locales/zh-CN.yml +1 -0
  73. data/config/locales/zh-TW.yml +1 -0
  74. data/db/migrate/20181016142511_make_authors_polymorphic_for_comments.rb +1 -0
  75. data/db/migrate/20181019092928_make_author_polymorphic_for_comment_votes.rb +1 -0
  76. data/lib/decidim/comments/comment_serializer.rb +1 -1
  77. data/lib/decidim/comments/comment_vote_serializer.rb +1 -1
  78. data/lib/decidim/comments/test/shared_examples/translatable_comment.rb +1 -1
  79. data/lib/decidim/comments/version.rb +1 -1
  80. metadata +13 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f449f8ff515ba627b30631ba707ce7269ccd13e7535ec9025cb5216e6adb4eb1
4
- data.tar.gz: 50bf6b4217c3de8a34df821b97b590c42a8e42a2fd133caeda6f7865ad2c0d5c
3
+ metadata.gz: 15e0e5dd8fbb2fc7171061fa36077e83f956f3ada42b41dfa32cd8e8f60cdd0a
4
+ data.tar.gz: 6cb4e67d56972f657983cc174806b8766d0916fb55b7ca783ee2e8a684859283
5
5
  SHA512:
6
- metadata.gz: e3b12c153436bd614bc1175a8d542d18c50ebf46240b88d2ef1791d85c4e45daf16e59d7b219d2904469264d18002d26fb2bfcd598cc8826e569e44a6df76144
7
- data.tar.gz: 94e537252c62d78c8725023753b40acdc664c962555b0da57ecb76c5b1fe01a62f770ea79364792ed7319bfb239332f84532e6237f1e27ad4ca091484158f85e
6
+ metadata.gz: a3a7482658e91430342214a3d668979c0450b1203c28725ab083c46773b6c39474f148a4489238c90187cda2407a81edbc1c7a1b9bd26944081ce36261f86e7e
7
+ data.tar.gz: ee42d7e4922a5cbc826a1a98f73b1d1056d4ce6879a398da32ad6962d9987323f7b37b2e1fc57111251baf2185301cbdc0e370621107778afd2fb47263dc285b
@@ -186,11 +186,11 @@ module Decidim
186
186
  end
187
187
 
188
188
  def has_replies?
189
- model.comment_threads.includes(:moderation).collect { |c| !c.deleted? && !c.hidden? }.any?
189
+ model.comment_threads.not_hidden.not_deleted.exists?
190
190
  end
191
191
 
192
192
  def has_replies_in_children?
193
- has_replies? || model.comment_threads.includes(:moderation).collect { |t| t.comment_threads.includes(:moderation).collect { |c| !c.deleted? && !c.hidden? }.any? }.any?
193
+ model.descendants.where(decidim_commentable_type: "Decidim::Comments::Comment").not_hidden.not_deleted.exists?
194
194
  end
195
195
 
196
196
  # action_authorization_button expects current_component to be available
@@ -0,0 +1,3 @@
1
+ <div class="callout primary loading-comments">
2
+ <p><%= t("decidim.components.comments.loading") %></p>
3
+ </div>
@@ -16,6 +16,7 @@
16
16
  <%= single_comment_warning %>
17
17
  <%= blocked_comments_warning %>
18
18
  <div class="comment-threads">
19
+ <%= comments_loading %>
19
20
  <% comments.each do |comment| %>
20
21
  <%= cell("decidim/comments/comment_thread", comment, order: order) %>
21
22
  <% end %>
@@ -22,6 +22,12 @@ module Decidim
22
22
  render :single_comment_warning
23
23
  end
24
24
 
25
+ def comments_loading
26
+ return if single_comment?
27
+
28
+ render :comments_loading
29
+ end
30
+
25
31
  def blocked_comments_warning
26
32
  return unless comments_blocked?
27
33
  return unless user_comments_blocked?
@@ -43,11 +49,7 @@ module Decidim
43
49
  end
44
50
 
45
51
  def comments
46
- if single_comment?
47
- [single_comment]
48
- else
49
- SortedComments.for(model, order_by: order)
50
- end
52
+ single_comment? ? [single_comment] : []
51
53
  end
52
54
 
53
55
  def comments_count
@@ -97,17 +99,10 @@ module Decidim
97
99
  commentableGid: model.to_signed_global_id.to_s,
98
100
  commentsUrl: decidim_comments.comments_path,
99
101
  rootDepth: root_depth,
100
- lastCommentId: last_comment_id,
101
102
  order: order
102
103
  }
103
104
  end
104
105
 
105
- def last_comment_id
106
- Decidim::Comments::Comment.where(
107
- root_commentable: model
108
- ).order(:id).pluck(:id).last
109
- end
110
-
111
106
  def single_comment?
112
107
  single_comment.present?
113
108
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Comments
5
5
  # A command with all the business logic to create a new comment
6
- class CreateComment < Rectify::Command
6
+ class CreateComment < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # form - A form object with the params.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Comments
5
5
  # A command with all the business logic to delete a comment
6
- class DeleteComment < Rectify::Command
6
+ class DeleteComment < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # comment - The comment to delete.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Comments
5
5
  # A command with all the business logic to update an existing comment
6
- class UpdateComment < Rectify::Command
6
+ class UpdateComment < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # comment - Decidim::Comments::Comment
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Comments
5
5
  # A command with all the business logic to upvote a comment
6
- class VoteComment < Rectify::Command
6
+ class VoteComment < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # comment - A comment
@@ -23,6 +23,12 @@ module Decidim
23
23
  order_by: order,
24
24
  after: params.fetch(:after, 0).to_i
25
25
  )
26
+ @comments = @comments.reject do |comment|
27
+ next if comment.depth < 1
28
+ next if !comment.deleted? && !comment.hidden?
29
+
30
+ comment.commentable.descendants.where(decidim_commentable_type: "Decidim::Comments::Comment").not_hidden.not_deleted.blank?
31
+ end
26
32
  @comments_count = commentable.comments_count
27
33
 
28
34
  respond_to do |format|
@@ -136,14 +142,12 @@ module Decidim
136
142
 
137
143
  def handle_success(comment)
138
144
  @comment = comment
139
- @comments_count = begin
140
- case commentable
141
- when Decidim::Comments::Comment
142
- commentable.root_commentable.comments_count
143
- else
144
- commentable.comments_count
145
- end
146
- end
145
+ @comments_count = case commentable
146
+ when Decidim::Comments::Comment
147
+ commentable.root_commentable.comments_count
148
+ else
149
+ commentable.comments_count
150
+ end
147
151
  end
148
152
 
149
153
  def commentable_gid
@@ -172,7 +176,7 @@ module Decidim
172
176
  end
173
177
 
174
178
  def commentable_path
175
- return commentable.polymorphic_resource_path({}) if commentable&.respond_to?(:polymorphic_resource_path)
179
+ return commentable.polymorphic_resource_path({}) if commentable.respond_to?(:polymorphic_resource_path)
176
180
 
177
181
  resource_locator(commentable).path
178
182
  end
@@ -14,7 +14,7 @@ module Decidim
14
14
  end
15
15
 
16
16
  def resource_link_path
17
- return root_commentable.polymorphic_resource_path(url_params) if root_commentable&.respond_to?(:polymorphic_resource_path)
17
+ return root_commentable.polymorphic_resource_path(url_params) if root_commentable.respond_to?(:polymorphic_resource_path)
18
18
 
19
19
  resource_locator(root_commentable).path(url_params)
20
20
  end
@@ -10,12 +10,13 @@ module Decidim
10
10
  include Decidim::Authorable
11
11
  include Decidim::Comments::Commentable
12
12
  include Decidim::FriendlyDates
13
- include Decidim::DataPortability
13
+ include Decidim::DownloadYourData
14
14
  include Decidim::Traceable
15
15
  include Decidim::Loggable
16
16
  include Decidim::Searchable
17
17
  include Decidim::TranslatableResource
18
18
  include Decidim::TranslatableAttributes
19
+ include Decidim::ActsAsTree
19
20
 
20
21
  # Limit the max depth of a comment tree. If C is a comment and R is a reply:
21
22
  # C (depth 0)
@@ -27,6 +28,8 @@ module Decidim
27
28
 
28
29
  translatable_fields :body
29
30
 
31
+ parent_item_foreign_key :decidim_commentable_id
32
+
30
33
  belongs_to :commentable, foreign_key: "decidim_commentable_id", foreign_type: "decidim_commentable_type", polymorphic: true
31
34
  belongs_to :root_commentable, foreign_key: "decidim_root_commentable_id", foreign_type: "decidim_root_commentable_type", polymorphic: true, touch: true
32
35
  belongs_to :participatory_space, foreign_key: "decidim_participatory_space_id", foreign_type: "decidim_participatory_space_type", polymorphic: true, optional: true
@@ -130,7 +133,7 @@ module Decidim
130
133
  def reported_content_url
131
134
  url_params = { anchor: "comment_#{id}" }
132
135
 
133
- if root_commentable&.respond_to?(:polymorphic_resource_url)
136
+ if root_commentable.respond_to?(:polymorphic_resource_url)
134
137
  root_commentable.polymorphic_resource_url(url_params)
135
138
  else
136
139
  ResourceLocatorPresenter.new(root_commentable).url(url_params)
@@ -155,7 +158,7 @@ module Decidim
155
158
  # Expects all +resources+ to be of the same "commentable_type".
156
159
  # If the result is not `Decidim::Comments::Commentable` returns `nil`.
157
160
  def self.user_commentators_ids_in(resources)
158
- if resources.first&.kind_of?(Decidim::Comments::Commentable)
161
+ if resources.first.is_a?(Decidim::Comments::Commentable)
159
162
  commentable_type = resources.first.class.name
160
163
  Decidim::Comments::Comment.select("DISTINCT decidim_author_id").not_hidden.not_deleted
161
164
  .where(decidim_commentable_id: resources.pluck(:id))
@@ -167,7 +170,7 @@ module Decidim
167
170
  end
168
171
 
169
172
  def can_participate?(user)
170
- return true unless root_commentable&.respond_to?(:can_participate?)
173
+ return true unless root_commentable.respond_to?(:can_participate?)
171
174
 
172
175
  root_commentable.can_participate?(user)
173
176
  end
@@ -5,7 +5,7 @@ module Decidim
5
5
  # A comment can include user votes. A user should be able to upVote, votes with
6
6
  # weight 1 and downVote, votes with weight -1.
7
7
  class CommentVote < ApplicationRecord
8
- include Decidim::DataPortability
8
+ include Decidim::DownloadYourData
9
9
 
10
10
  belongs_to :comment, foreign_key: "decidim_comment_id", class_name: "Comment"
11
11
  belongs_to :author, foreign_key: "decidim_author_id", foreign_type: "decidim_author_type", polymorphic: true
@@ -1,4 +1,6 @@
1
1
  /* eslint id-length: ["error", { "exceptions": ["$"] }] */
2
+ /* eslint max-lines: ["error", {"max": 350, "skipBlankLines": true}] */
3
+
2
4
 
3
5
  /**
4
6
  * A plain Javascript component that handles the comments.
@@ -10,6 +12,8 @@
10
12
  // This is necessary for testing purposes
11
13
  const $ = window.$;
12
14
 
15
+ import Rails from "@rails/ujs";
16
+
13
17
  import { createCharacterCounter } from "src/decidim/input_character_counter"
14
18
  import ExternalLink from "src/decidim/external_link"
15
19
  import updateExternalDomainLinks from "src/decidim/external_domain_warning"
@@ -23,6 +27,8 @@ export default class CommentsComponent {
23
27
  this.order = config.order;
24
28
  this.lastCommentId = config.lastCommentId;
25
29
  this.pollingInterval = config.pollingInterval || 15000;
30
+ this.singleComment = config.singleComment;
31
+ this.toggleTranslations = config.toggleTranslations;
26
32
  this.id = this.$element.attr("id") || this._getUID();
27
33
  this.mounted = false;
28
34
  }
@@ -36,6 +42,9 @@ export default class CommentsComponent {
36
42
  if (this.$element.length > 0 && !this.mounted) {
37
43
  this.mounted = true;
38
44
  this._initializeComments(this.$element);
45
+ if (!this.singleComment) {
46
+ this._fetchComments();
47
+ }
39
48
 
40
49
  $(".order-by__dropdown .is-submenu-item a", this.$element).on("click.decidim-comments", () => this._onInitOrder());
41
50
  }
@@ -133,8 +142,6 @@ export default class CommentsComponent {
133
142
  $text.get(0).addEventListener("emoji.added", this._onTextInput);
134
143
  }
135
144
  });
136
-
137
- this._pollComments();
138
145
  }
139
146
 
140
147
  /**
@@ -200,20 +207,32 @@ export default class CommentsComponent {
200
207
  this._stopPolling();
201
208
 
202
209
  this.pollTimeout = setTimeout(() => {
203
- Rails.ajax({
204
- url: this.commentsUrl,
205
- type: "GET",
206
- data: new URLSearchParams({
207
- "commentable_gid": this.commentableGid,
208
- "root_depth": this.rootDepth,
209
- "order": this.order,
210
- "after": this.lastCommentId
211
- }),
212
- success: this._pollComments()
213
- })
210
+ this._fetchComments();
214
211
  }, this.pollingInterval);
215
212
  }
216
213
 
214
+ /**
215
+ * Sends an ajax request based on current
216
+ * params to get comments for the component
217
+ * @private
218
+ * @returns {Void} - Returns nothing
219
+ */
220
+ _fetchComments() {
221
+ Rails.ajax({
222
+ url: this.commentsUrl,
223
+ type: "GET",
224
+ data: new URLSearchParams({
225
+ "commentable_gid": this.commentableGid,
226
+ "root_depth": this.rootDepth,
227
+ "order": this.order,
228
+ "after": this.lastCommentId,
229
+ ...(this.toggleTranslations && { "toggle_translations": this.toggleTranslations }),
230
+ ...(this.lastCommentId && { "after": this.lastCommentId })
231
+ }),
232
+ success: this._pollComments()
233
+ })
234
+ }
235
+
217
236
  /**
218
237
  * Stops polling for new comments.
219
238
  * @private
@@ -13,6 +13,10 @@ window.$.ajax = jest.fn().mockImplementation((...args) => $.ajax(...args));
13
13
  import Quill from "quill"
14
14
  window.Quill = Quill
15
15
 
16
+ // Rails.ajax is used by the fetching/polling of the comments
17
+ import Rails from "@rails/ujs";
18
+ jest.mock("@rails/ujs");
19
+
16
20
  // Fake timers for testing polling
17
21
  jest.useFakeTimers();
18
22
 
@@ -383,16 +387,16 @@ describe("CommentsComponent", () => {
383
387
 
384
388
  jest.advanceTimersByTime(1000);
385
389
 
386
- expect(window.$.ajax).toHaveBeenCalledWith({
390
+ expect(Rails.ajax).toHaveBeenCalledWith({
387
391
  url: "/comments",
388
- method: "GET",
389
- contentType: "application/javascript",
390
- data: {
392
+ type: "GET",
393
+ data: new URLSearchParams({
391
394
  "commentable_gid": "commentable-gid",
392
395
  "root_depth": 0,
393
396
  order: "older",
394
397
  after: 456
395
- }
398
+ }),
399
+ success: window.undefined
396
400
  });
397
401
  });
398
402
 
@@ -51,13 +51,11 @@ module Decidim
51
51
  end
52
52
 
53
53
  def commentable
54
- @commentable ||= begin
55
- if comment
56
- comment.root_commentable
57
- else
58
- context.fetch(:commentable, nil)
59
- end
60
- end
54
+ @commentable ||= if comment
55
+ comment.root_commentable
56
+ else
57
+ context.fetch(:commentable, nil)
58
+ end
61
59
  end
62
60
 
63
61
  def comment
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Comments
5
5
  # A class used to find comments for a commentable resource
6
- class SortedComments < Rectify::Query
6
+ class SortedComments < Decidim::Query
7
7
  attr_reader :commentable
8
8
 
9
9
  # Syntactic sugar to initialize the class and return the queried objects.
@@ -34,8 +34,6 @@ module Decidim
34
34
  .includes(:author, :user_group, :up_votes, :down_votes)
35
35
 
36
36
  case @options[:order_by]
37
- when "older"
38
- order_by_older(scope)
39
37
  when "recent"
40
38
  order_by_recent(scope)
41
39
  when "best_rated"
@@ -117,7 +117,7 @@ module Decidim
117
117
  }
118
118
  }.deep_merge(users)
119
119
 
120
- Decidim::EventsManager.publish(data)
120
+ Decidim::EventsManager.publish(**data)
121
121
  end
122
122
  end
123
123
  end
@@ -4,6 +4,7 @@
4
4
  var $comments = $("#" + rootCommentableId);
5
5
  var component = $comments.data("comments");
6
6
 
7
+ $(".loading-comments").addClass("hide");
7
8
  <% @comments.each do |comment| %>
8
9
  var commentId = <%= comment.id.to_json %>;
9
10
  var commentHtml = '<%== j(render comment).strip %>';
@@ -6,6 +6,7 @@
6
6
  component.unmountComponent();
7
7
 
8
8
  var commentsHtml = '<%== j(render partial: "comments").strip %>';
9
+ $(".loading-comments").addClass("hide");
9
10
  $comments.replaceWith(commentsHtml);
10
11
 
11
12
  $comments = $("#" + rootCommentableId);
@@ -1 +1,2 @@
1
+ ---
1
2
  am:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ar:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  bg:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ca:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  cs:
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  da:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  de:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  el:
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  eo:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  es-MX:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  es-PY:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  es:
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  et:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  eu:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fi-pl:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fi:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fr-CA:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fr:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ga:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  gl:
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  hr:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  hu:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  id:
2
3
  activemodel:
3
4
  models:
@@ -1,4 +1,5 @@
1
- is-IS:
1
+ ---
2
+ is:
2
3
  decidim:
3
4
  components:
4
5
  add_comment_form:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  it:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ja:
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  ko:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  lb:
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  lt:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  lv:
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  mt:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  nl:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  "no":
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  om:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  pl:
2
3
  activemodel:
3
4
  models:
@@ -1,4 +1,5 @@
1
- pt-BR:
1
+ ---
2
+ pt:
2
3
  activemodel:
3
4
  models:
4
5
  decidim/comments/comment_by_followed_user_event: Comente
@@ -1,3 +1,4 @@
1
+ ---
1
2
  pt:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ro:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ru:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  si:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sk:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sl:
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  so:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sr:
2
3
  decidim:
3
4
  components:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sv:
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  sw:
@@ -1 +1,2 @@
1
+ ---
1
2
  ti:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  tr:
2
3
  activemodel:
3
4
  models:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  uk:
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  val:
@@ -1 +1,2 @@
1
+ ---
1
2
  vi:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  zh-CN:
2
3
  activemodel:
3
4
  models:
@@ -1 +1,2 @@
1
+ ---
1
2
  zh-TW:
@@ -4,6 +4,7 @@ class MakeAuthorsPolymorphicForComments < ActiveRecord::Migration[5.2]
4
4
  class Comment < ApplicationRecord
5
5
  self.table_name = :decidim_comments_comments
6
6
  end
7
+
7
8
  def change
8
9
  add_column :decidim_comments_comments, :decidim_author_type, :string
9
10
 
@@ -4,6 +4,7 @@ class MakeAuthorPolymorphicForCommentVotes < ActiveRecord::Migration[5.2]
4
4
  class CommentVote < ApplicationRecord
5
5
  self.table_name = :decidim_comments_comment_votes
6
6
  end
7
+
7
8
  def change
8
9
  add_column :decidim_comments_comment_votes, :decidim_author_type, :string
9
10
 
@@ -32,7 +32,7 @@ module Decidim
32
32
  private
33
33
 
34
34
  def root_commentable_url
35
- @root_commentable_url ||= if resource.root_commentable&.respond_to?(:polymorphic_resource_url)
35
+ @root_commentable_url ||= if resource.root_commentable.respond_to?(:polymorphic_resource_url)
36
36
  resource.root_commentable.polymorphic_resource_url
37
37
  else
38
38
  ResourceLocatorPresenter.new(resource.root_commentable).url
@@ -37,7 +37,7 @@ module Decidim
37
37
  private
38
38
 
39
39
  def root_commentable_url
40
- @root_commentable_url ||= if resource.comment.root_commentable&.respond_to?(:polymorphic_resource_url)
40
+ @root_commentable_url ||= if resource.comment.root_commentable.respond_to?(:polymorphic_resource_url)
41
41
  resource.comment.root_commentable.polymorphic_resource_url
42
42
  else
43
43
  ResourceLocatorPresenter.new(resource.comment.root_commentable).url
@@ -5,7 +5,7 @@ require "spec_helper"
5
5
  shared_examples_for "a translated comment event" do
6
6
  describe "translated notifications" do
7
7
  let(:en_body) { "This is Sparta!" }
8
- let(:body) { { "en": en_body, "machine_translations": { "ca": "C'est Sparta!" } } }
8
+ let(:body) { { en: en_body, machine_translations: { ca: "C'est Sparta!" } } }
9
9
  let(:participatory_process) { create :participatory_process, organization: organization }
10
10
  let(:component) { create(:component, participatory_space: participatory_process) }
11
11
  let(:commentable) { create(:dummy_resource, component: component) }
@@ -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.26.2"
7
+ "0.27.0.rc1"
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.26.2
4
+ version: 0.27.0.rc1
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: 2022-06-14 00:00:00.000000000 Z
13
+ date: 2022-06-27 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.26.2
21
+ version: 0.27.0.rc1
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.26.2
28
+ version: 0.27.0.rc1
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.26.2
55
+ version: 0.27.0.rc1
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.26.2
62
+ version: 0.27.0.rc1
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.26.2
69
+ version: 0.27.0.rc1
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.26.2
76
+ version: 0.27.0.rc1
77
77
  description: Pluggable comments system for some components.
78
78
  email:
79
79
  - josepjaume@gmail.com
@@ -107,6 +107,7 @@ files:
107
107
  - app/cells/decidim/comments/comment_thread_cell.rb
108
108
  - app/cells/decidim/comments/comments/add_comment.erb
109
109
  - app/cells/decidim/comments/comments/blocked_comments_warning.erb
110
+ - app/cells/decidim/comments/comments/comments_loading.erb
110
111
  - app/cells/decidim/comments/comments/order_control.erb
111
112
  - app/cells/decidim/comments/comments/show.erb
112
113
  - app/cells/decidim/comments/comments/single_comment_warning.erb
@@ -296,14 +297,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
296
297
  requirements:
297
298
  - - ">="
298
299
  - !ruby/object:Gem::Version
299
- version: '2.7'
300
+ version: '3.0'
300
301
  required_rubygems_version: !ruby/object:Gem::Requirement
301
302
  requirements:
302
- - - ">="
303
+ - - ">"
303
304
  - !ruby/object:Gem::Version
304
- version: '0'
305
+ version: 1.3.1
305
306
  requirements: []
306
- rubygems_version: 3.1.6
307
+ rubygems_version: 3.2.22
307
308
  signing_key:
308
309
  specification_version: 4
309
310
  summary: Decidim comments module