decidim-comments 0.27.6 → 0.28.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/comments/comment/actions.erb +13 -7
  3. data/app/cells/decidim/comments/comment/alignment_badge.erb +1 -4
  4. data/app/cells/decidim/comments/comment/deletion_data.erb +9 -1
  5. data/app/cells/decidim/comments/comment/moderation_data.erb +1 -1
  6. data/app/cells/decidim/comments/comment/replies.erb +3 -0
  7. data/app/cells/decidim/comments/comment/show.erb +72 -35
  8. data/app/cells/decidim/comments/comment/votes.erb +14 -14
  9. data/app/cells/decidim/comments/comment_activity_cell.rb +11 -7
  10. data/app/cells/decidim/comments/comment_card_cell.rb +2 -2
  11. data/app/cells/decidim/comments/comment_cell.rb +9 -21
  12. data/app/cells/decidim/comments/comment_form/comment_as.erb +3 -3
  13. data/app/cells/decidim/comments/comment_form/opinion.erb +18 -0
  14. data/app/cells/decidim/comments/comment_form/show.erb +33 -16
  15. data/app/cells/decidim/comments/comment_form_cell.rb +9 -1
  16. data/app/cells/decidim/comments/comment_metadata_cell.rb +27 -0
  17. data/app/cells/decidim/comments/comment_s_cell.rb +27 -0
  18. data/app/cells/decidim/comments/comment_thread/show.erb +2 -5
  19. data/app/cells/decidim/comments/comment_thread_cell.rb +0 -6
  20. data/app/cells/decidim/comments/comments/add_comment.erb +1 -20
  21. data/app/cells/decidim/comments/comments/blocked_comments_warning.erb +1 -3
  22. data/app/cells/decidim/comments/comments/comments_loading.erb +1 -3
  23. data/app/cells/decidim/comments/comments/order_control.erb +11 -35
  24. data/app/cells/decidim/comments/comments/show.erb +8 -9
  25. data/app/cells/decidim/comments/comments/single_comment_warning.erb +6 -9
  26. data/app/cells/decidim/comments/comments/user_comments_blocked_warning.erb +9 -6
  27. data/app/cells/decidim/comments/comments_cell.rb +1 -1
  28. data/app/cells/decidim/comments/edit_comment_modal_form/show.erb +20 -15
  29. data/app/commands/decidim/comments/create_comment.rb +17 -5
  30. data/app/commands/decidim/comments/delete_comment.rb +1 -1
  31. data/app/commands/decidim/comments/update_comment.rb +14 -2
  32. data/app/commands/decidim/comments/vote_comment.rb +1 -1
  33. data/app/controllers/decidim/comments/comments_controller.rb +14 -9
  34. data/app/controllers/decidim/comments/votes_controller.rb +1 -1
  35. data/app/events/decidim/comments/comment_by_followed_user_event.rb +1 -1
  36. data/app/events/decidim/comments/comment_by_followed_user_group_event.rb +1 -1
  37. data/app/events/decidim/comments/comment_event.rb +2 -3
  38. data/app/events/decidim/comments/reply_created_event.rb +1 -1
  39. data/app/events/decidim/comments/user_group_mentioned_event.rb +1 -1
  40. data/app/events/decidim/comments/user_mentioned_event.rb +1 -1
  41. data/app/helpers/decidim/comments/comment_cells_helper.rb +1 -1
  42. data/app/jobs/decidim/comments/hide_all_created_by_author_job.rb +13 -0
  43. data/app/models/decidim/comments/comment.rb +9 -7
  44. data/app/models/decidim/comments/comment_vote.rb +0 -10
  45. data/app/models/decidim/comments/seed.rb +30 -14
  46. data/app/packs/entrypoints/decidim_comments.js +5 -0
  47. data/app/packs/src/decidim/comments/comments.component.js +27 -36
  48. data/app/packs/src/decidim/comments/comments.component.test.js +218 -240
  49. data/app/packs/src/decidim/comments/comments.component_for_testing.js +1 -1
  50. data/app/packs/src/decidim/comments/comments.js +20 -1
  51. data/app/packs/stylesheets/comments.scss +327 -0
  52. data/app/queries/decidim/comments/metrics/comments_metric_manage.rb +1 -1
  53. data/app/queries/decidim/comments/sorted_comments.rb +10 -10
  54. data/app/services/decidim/comments/comment_creation.rb +1 -1
  55. data/app/services/decidim/comments/new_comment_notification_creator.rb +8 -8
  56. data/app/views/decidim/comments/admin/shared/_availability_fields.html.erb +4 -9
  57. data/app/views/decidim/comments/comments/_comment.html.erb +1 -1
  58. data/app/views/decidim/comments/comments/_comments.html.erb +1 -1
  59. data/app/views/decidim/comments/comments/_delete.html.erb +2 -4
  60. data/app/views/decidim/comments/comments/_moderated.html.erb +2 -4
  61. data/app/views/decidim/comments/comments/create.js.erb +5 -3
  62. data/app/views/decidim/comments/comments/delete.js.erb +4 -1
  63. data/app/views/decidim/comments/comments/index.js.erb +8 -1
  64. data/app/views/decidim/comments/comments/reload.js.erb +1 -2
  65. data/app/views/decidim/comments/comments/update.js.erb +5 -4
  66. data/app/views/decidim/comments/votes/create.js.erb +5 -5
  67. data/config/assets.rb +3 -0
  68. data/config/locales/ar.yml +0 -16
  69. data/config/locales/bg.yml +0 -23
  70. data/config/locales/ca.yml +15 -17
  71. data/config/locales/cs.yml +8 -10
  72. data/config/locales/de.yml +7 -9
  73. data/config/locales/el.yml +3 -11
  74. data/config/locales/en.yml +10 -12
  75. data/config/locales/es-MX.yml +10 -12
  76. data/config/locales/es-PY.yml +10 -12
  77. data/config/locales/es.yml +16 -18
  78. data/config/locales/eu.yml +6 -8
  79. data/config/locales/fi-plain.yml +7 -9
  80. data/config/locales/fi.yml +7 -9
  81. data/config/locales/fr-CA.yml +9 -11
  82. data/config/locales/fr.yml +9 -11
  83. data/config/locales/ga-IE.yml +0 -4
  84. data/config/locales/gl.yml +0 -16
  85. data/config/locales/hu.yml +3 -11
  86. data/config/locales/id-ID.yml +0 -11
  87. data/config/locales/is-IS.yml +0 -8
  88. data/config/locales/it.yml +0 -16
  89. data/config/locales/ja.yml +6 -8
  90. data/config/locales/lb.yml +0 -16
  91. data/config/locales/lt.yml +7 -10
  92. data/config/locales/lv.yml +0 -11
  93. data/config/locales/nl.yml +0 -16
  94. data/config/locales/no.yml +0 -16
  95. data/config/locales/pl.yml +7 -11
  96. data/config/locales/pt-BR.yml +0 -18
  97. data/config/locales/pt.yml +0 -16
  98. data/config/locales/ro-RO.yml +6 -14
  99. data/config/locales/ru.yml +0 -11
  100. data/config/locales/sk.yml +0 -11
  101. data/config/locales/sq-AL.yml +0 -38
  102. data/config/locales/sv.yml +2 -16
  103. data/config/locales/tr-TR.yml +1 -13
  104. data/config/locales/uk.yml +0 -8
  105. data/config/locales/zh-CN.yml +0 -13
  106. data/config/locales/zh-TW.yml +1 -9
  107. data/lib/decidim/api/comment_type.rb +2 -2
  108. data/lib/decidim/api/commentable_interface.rb +1 -1
  109. data/lib/decidim/comments/comment_serializer.rb +1 -1
  110. data/lib/decidim/comments/comment_vote_serializer.rb +1 -1
  111. data/lib/decidim/comments/commentable.rb +1 -1
  112. data/lib/decidim/comments/comments_helper.rb +6 -3
  113. data/lib/decidim/comments/engine.rb +31 -1
  114. data/lib/decidim/comments/export.rb +1 -1
  115. data/lib/decidim/comments/test/factories.rb +9 -16
  116. data/lib/decidim/comments/test/shared_examples/comment_event.rb +4 -4
  117. data/lib/decidim/comments/test/shared_examples/comment_voted_event.rb +4 -4
  118. data/lib/decidim/comments/test/shared_examples/create_comment_context.rb +5 -5
  119. data/lib/decidim/comments/test/shared_examples/has_comments_availability_attributes.rb +2 -2
  120. data/lib/decidim/comments/test/shared_examples/translatable_comment.rb +3 -3
  121. data/lib/decidim/comments/version.rb +1 -1
  122. metadata +30 -27
  123. data/app/cells/decidim/comments/comment/author.erb +0 -1
  124. data/app/cells/decidim/comments/comment/utilities.erb +0 -41
  125. data/app/cells/decidim/comments/comment_m/footer.erb +0 -5
  126. data/app/cells/decidim/comments/comment_m/top.erb +0 -7
  127. data/app/cells/decidim/comments/comment_m_cell.rb +0 -29
  128. data/app/cells/decidim/comments/comment_thread/title.erb +0 -3
  129. data/config/locales/he-IL.yml +0 -1
  130. data/db/migrate/20240304092558_add_comment_vote_counter_cache_to_comments.rb +0 -21
  131. data/decidim-comments.gemspec +0 -33
@@ -1,41 +0,0 @@
1
- <div class="comment__header__context-menu">
2
- <label for="<%= context_menu_id %>" data-toggle="<%= context_menu_id %>">
3
- <%= icon "ellipses" %>
4
- </label>
5
- <ul id="<%= context_menu_id %>" data-dropdown data-close-on-click="true" data-position="left" data-alignment="top" class="card dropdown-pane comment__header__context-menu__content">
6
- <li>
7
- <button type="button" class="link-alt comment__header__context-menu__content-item" data-open="<%= current_user.present? ? "flagModalComment#{model.id}" : "loginModal" %>" title="<%= t("decidim.components.comment.report.title") %>" aria-controls="<%= current_user.present? ? "flagModalComment#{model.id}" : "loginModal" %>" aria-haspopup="dialog" tabindex="0">
8
- <%= icon "flag", class: "icon--small", aria_label: t("decidim.components.comment.report.title") %>
9
- <span><%= t("decidim.components.comment.report.action") %></span>
10
- </button>
11
- </li>
12
- <li>
13
- <%= link_to "#{commentable_path("commentId" => model.id)}#comment_#{model.id}", target: "_blank", class: "comment__header__context-menu__content-item", title: t("decidim.components.comment.single_comment_link_title") do %>
14
- <%= icon "link-intact", class: "icon--small", aria_label: t("decidim.components.comment.single_comment_link_title") %>
15
- <span><%= t("decidim.components.comment.single_comment_link_title") %></span>
16
- <% end %>
17
- </li>
18
- <% if model.authored_by?(current_user) %>
19
- <li>
20
- <button type="button" class="link-alt comment__header__context-menu__content-item" data-open="<%= "editCommentModal#{model.id}" %>" title="<%= t("decidim.components.comment.edit") %>" aria-controls="<%= "editCommentModal#{model.id}" %>" aria-haspopup="dialog" tabindex="0">
21
- <%= icon "pencil", class: "icon--small", aria_label: t("decidim.components.comment.edit") %>
22
- <span><%= t("decidim.components.comment.edit") %></span>
23
- </button>
24
- </li>
25
- <li>
26
- <%= link_to comment_path, remote: true, method: :delete, class: "comment__header__context-menu__content-item", data: { confirm: t("decidim.components.comment.confirm_destroy") } do %>
27
- <%= icon "trash", class: "icon--small", aria_label: t("decidim.components.comment.delete") %>
28
- <span><%= t("decidim.components.comment.delete") %></span>
29
- <% end %>
30
- </li>
31
- <% end %>
32
- </ul>
33
- </div>
34
- <% unless reloaded? %>
35
- <% if current_user.present? %>
36
- <%= cell("decidim/flag_modal", model, modal_id: "flagModalComment#{model.id}") %>
37
- <% end %>
38
- <% if model.authored_by?(current_user) %>
39
- <%= cell("decidim/comments/edit_comment_modal_form", model, modal_id: "editCommentModal#{model.id}") %>
40
- <% end %>
41
- <% end %>
@@ -1,5 +0,0 @@
1
- <div class="card__footer">
2
- <div class="card__support">
3
- <%= link_to t("view", scope: "decidim.comments"), resource_link_path, class: "card__button button button--sc small" %>
4
- </div>
5
- </div>
@@ -1,7 +0,0 @@
1
- <div class="card__top">
2
- <% if render_space? %>
3
- <div class="card__content text-small">
4
- <span class="muted"><%= searchable_resource_human_name(model.root_commentable.class, count: 1) %>:</span>&nbsp;<%= link_to root_commentable_title, resource_link_path, class: "card__link text-ellipsis" %>
5
- </div>
6
- <% end %>
7
- </div>
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Comments
5
- # This cell renders the Medium (:m) comment card
6
- # for an given instance of a Comment
7
- class CommentMCell < Decidim::CardMCell
8
- include CommentCellsHelper
9
-
10
- def statuses
11
- []
12
- end
13
-
14
- def comment
15
- model
16
- end
17
-
18
- def has_header?
19
- false
20
- end
21
-
22
- delegate :participatory_space, to: :model
23
-
24
- def description
25
- strip_tags(model.formatted_body).truncate(200, separator: /\s/)
26
- end
27
- end
28
- end
29
- end
@@ -1,3 +0,0 @@
1
- <h6 class="comment-thread__title">
2
- <%= t("decidim.components.comment_thread.title", authorName: author_name) %>
3
- </h6>
@@ -1 +0,0 @@
1
- he:
@@ -1,21 +0,0 @@
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
@@ -1,33 +0,0 @@
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