decidim-core 0.30.0.rc3 → 0.30.0

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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/participatory_space_dropdown_metadata/show.erb +5 -3
  3. data/app/commands/decidim/create_report.rb +1 -6
  4. data/app/commands/decidim/search.rb +14 -0
  5. data/app/controllers/decidim/reports_controller.rb +1 -1
  6. data/app/forms/decidim/account_form.rb +4 -1
  7. data/app/mailers/decidim/reported_mailer.rb +1 -0
  8. data/app/models/decidim/action_log.rb +1 -9
  9. data/app/packs/src/decidim/datepicker/datepicker_functions.js +3 -3
  10. data/app/packs/src/decidim/index.js +4 -2
  11. data/app/packs/stylesheets/decidim/_content_blocks.scss +4 -0
  12. data/app/packs/stylesheets/decidim/_header.scss +6 -2
  13. data/app/presenters/decidim/log/user_presenter.rb +1 -0
  14. data/app/presenters/decidim/user_presenter.rb +1 -1
  15. data/app/services/decidim/base_diff_renderer.rb +2 -0
  16. data/app/views/decidim/reported_mailer/hide.html.erb +17 -1
  17. data/app/views/decidim/reported_mailer/report.html.erb +1 -1
  18. data/app/views/decidim/searches/_count.html.erb +1 -1
  19. data/app/views/decidim/searches/_filters.html.erb +40 -38
  20. data/app/views/layouts/decidim/footer/_main_legal.html.erb +1 -1
  21. data/config/locales/ar.yml +3 -3
  22. data/config/locales/bg.yml +2 -2
  23. data/config/locales/bs-BA.yml +2 -0
  24. data/config/locales/ca-IT.yml +2400 -0
  25. data/config/locales/ca.yml +24 -2
  26. data/config/locales/cs.yml +10 -2
  27. data/config/locales/de.yml +13 -4
  28. data/config/locales/el.yml +2 -2
  29. data/config/locales/en.yml +22 -0
  30. data/config/locales/es-MX.yml +25 -3
  31. data/config/locales/es-PY.yml +25 -3
  32. data/config/locales/es.yml +23 -1
  33. data/config/locales/eu.yml +52 -31
  34. data/config/locales/fi-plain.yml +4 -3
  35. data/config/locales/fi.yml +4 -3
  36. data/config/locales/fr-CA.yml +16 -4
  37. data/config/locales/fr.yml +15 -3
  38. data/config/locales/ga-IE.yml +2 -0
  39. data/config/locales/gl.yml +3 -1
  40. data/config/locales/hu.yml +2 -2
  41. data/config/locales/id-ID.yml +2 -2
  42. data/config/locales/it.yml +12 -6
  43. data/config/locales/ja.yml +71 -9
  44. data/config/locales/lb.yml +5 -3
  45. data/config/locales/lv.yml +2 -2
  46. data/config/locales/nl.yml +2 -0
  47. data/config/locales/no.yml +2 -0
  48. data/config/locales/pl.yml +2 -2
  49. data/config/locales/pt-BR.yml +3 -3
  50. data/config/locales/pt.yml +2 -0
  51. data/config/locales/ro-RO.yml +172 -0
  52. data/config/locales/sk.yml +2 -2
  53. data/config/locales/sr-CS.yml +2 -0
  54. data/config/locales/sv.yml +19 -1
  55. data/config/locales/tr-TR.yml +3 -3
  56. data/config/locales/zh-CN.yml +2 -2
  57. data/config/locales/zh-TW.yml +2 -0
  58. data/lib/decidim/asset_router/storage.rb +7 -2
  59. data/lib/decidim/attributes/time_with_zone.rb +5 -1
  60. data/lib/decidim/content_parsers/blob_parser.rb +10 -8
  61. data/lib/decidim/core/test/shared_examples/reports_examples.rb +8 -15
  62. data/lib/decidim/core/test/shared_examples/uncommentable_component_examples.rb +26 -0
  63. data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +26 -0
  64. data/lib/decidim/core/version.rb +1 -1
  65. data/lib/decidim/moderation_tools.rb +14 -8
  66. data/lib/decidim/participatory_space_user.rb +1 -3
  67. data/lib/decidim/reportable.rb +6 -2
  68. data/lib/decidim/translatable_attributes.rb +5 -1
  69. data/lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake +3 -3
  70. metadata +7 -7
  71. data/lib/tasks/upgrade/clean_hidden_resources.rake +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1741dcb0de873587b3e2ff7eb8faae32fa98107e26b42a1c30e1cff7c876f7b3
4
- data.tar.gz: 7d5c4a405e277850a00645b6625097cf69a0b4b18dfdfa876be69ca045e71062
3
+ metadata.gz: cfb327cabebd03ca7eb5e5327c4c10f0e8f1509552e959206bf19c75032a4152
4
+ data.tar.gz: 8062e844f6cfa3e3777d0684e4f9e2e071b68355e9008639d7dbb06803b792ac
5
5
  SHA512:
6
- metadata.gz: fd16b3dbf24ccaf8cced5f0b23eb3dd496e5269bb19fb14010c4db9cc21e01f19c9cd19cff38540d1c9fd474d5e28d3e2a191d9a4e7d2bebde039eff54cdcf1b
7
- data.tar.gz: 598051abedb973a6c95e2504d03a30de39f050a57d414aa625c474a2483cc0db42b78e0c923456aab83b960f2ed0dc42983304bc1798d24e9e80a4f08907ad1d
6
+ metadata.gz: 9c7420aa2cb261ced54ea359fdaa3b4ef515b573ff6ef5eb2665df5f1d41858e4e1f5c08381d07e9fda401671be922dd9585dbcef14ada0cb3af197aea7cd66d
7
+ data.tar.gz: beeb21d36c097492f708b4de337e040bef8940e0d872b5e8d0d319c5ec6ad6f416d2f8ca225f8569a8e241d2b1140a17e6b9834ea4321343398ee38a074116c9
@@ -3,7 +3,9 @@
3
3
  <%= render :metadata %>
4
4
  <%= cell "decidim/content_blocks/menu_breadcrumb_last_activity", model, hide_participatory_space: true %>
5
5
  </div>
6
- <ul class="menu-bar__secondary-dropdown__menu">
7
- <%= render :links %>
8
- </ul>
6
+ <nav role="navigation" aria-label="<%= t("decidim.accessibility.secondary_menu") %>">
7
+ <ul class="menu-bar__secondary-dropdown__menu">
8
+ <%= render :links %>
9
+ </ul>
10
+ </nav>
9
11
  </div>
@@ -34,7 +34,7 @@ module Decidim
34
34
  send_report_notification_to_moderators
35
35
 
36
36
  if hideable?
37
- hide!
37
+ @tool.hide!
38
38
  send_hide_notification_to_moderators
39
39
  end
40
40
 
@@ -72,11 +72,6 @@ module Decidim
72
72
  hidden_by_admin? || (!@reportable.hidden? && moderation.report_count >= Decidim.max_reports_before_hiding)
73
73
  end
74
74
 
75
- def hide!
76
- @tool.hide!
77
- @tool.send_notification_to_author
78
- end
79
-
80
75
  def send_hide_notification_to_moderators
81
76
  participatory_space_moderators.each do |moderator|
82
77
  next unless moderator.email_on_moderations
@@ -37,6 +37,12 @@ module Decidim
37
37
  klass.order_by_id_list(result_ids.take(HIGHLIGHTED_RESULTS_COUNT))
38
38
  end
39
39
 
40
+ uncommentable_resources = uncommentable_resources(results) if results.present?
41
+ if uncommentable_resources.present?
42
+ results -= uncommentable_resources
43
+ results_count -= uncommentable_resources.count
44
+ end
45
+
40
46
  results_by_type.update(class_name => {
41
47
  count: results_count,
42
48
  results:
@@ -89,5 +95,13 @@ module Decidim
89
95
  query = query.global_search(I18n.transliterate(term)) if term.present?
90
96
  query
91
97
  end
98
+
99
+ def uncommentable_resources(results)
100
+ results.where(id: results.select { |obj| related_uncommentable_resources?(obj) }.map(&:id))
101
+ end
102
+
103
+ def related_uncommentable_resources?(object)
104
+ object.respond_to?(:commentable) && !object.commentable.commentable?
105
+ end
92
106
  end
93
107
  end
@@ -16,7 +16,7 @@ module Decidim
16
16
  CreateReport.call(@form, reportable) do
17
17
  on(:ok) do
18
18
  flash[:notice] = I18n.t("decidim.reports.create.success")
19
- redirect_back fallback_location: root_path
19
+ redirect_to reportable.reload.reported_content_url
20
20
  end
21
21
 
22
22
  on(:invalid) do
@@ -21,7 +21,10 @@ module Decidim
21
21
 
22
22
  validates :name, presence: true, format: { with: Decidim::User::REGEXP_NAME }
23
23
  validates :email, presence: true, "valid_email_2/email": { disposable: true }
24
- validates :nickname, presence: true, format: { with: Decidim::UserBaseEntity::REGEXP_NAME }
24
+ validates :nickname,
25
+ presence: true,
26
+ format: { with: Decidim::User::REGEXP_NICKNAME, message: :format },
27
+ length: { maximum: Decidim::User.nickname_max_length }
25
28
 
26
29
  validates :nickname, length: { maximum: Decidim::User.nickname_max_length, allow_blank: true }
27
30
  validates :password, password: { name: :name, email: :email, username: :nickname }, if: -> { password.present? }
@@ -25,6 +25,7 @@ module Decidim
25
25
  with_user(user) do
26
26
  @report = report
27
27
  @participatory_space = @report.moderation.participatory_space
28
+ @reportable = @report.moderation.reportable
28
29
  @organization = user.organization
29
30
  @user = user
30
31
  subject = I18n.t("hide.subject", scope: "decidim.reported_mailer")
@@ -157,15 +157,7 @@ module Decidim
157
157
 
158
158
  def self.publicable_public_resource_types
159
159
  @publicable_public_resource_types ||= public_resource_types
160
- .select { |klass| klass.constantize.column_names.include?("published_at") } - publicable_exceptions
161
- end
162
-
163
- def self.publicable_exceptions
164
- @publicable_exceptions = %w(
165
- Decidim::Blogs::Post
166
- ).select do |klass|
167
- klass.safe_constantize.present?
168
- end
160
+ .select { |klass| klass.constantize.column_names.include?("published_at") }
169
161
  end
170
162
 
171
163
  def self.ransackable_scopes(auth_object = nil)
@@ -29,12 +29,12 @@ export const formatInputDate = (date, formats) => {
29
29
  const month = dateList[1];
30
30
  const day = dateList[2];
31
31
 
32
- if (formats.order === "d-m-y") {
33
- return `${day}${formats.separator}${month}${formats.separator}${year}`;
32
+ if (formats.order === "m-d-y") {
33
+ return `${month}${formats.separator}${day}${formats.separator}${year}`;
34
34
  } else if (formats.order === "y-m-d") {
35
35
  return `${year}${formats.separator}${month}${formats.separator}${day}`;
36
36
  };
37
- return `${month}${formats.separator}${day}${formats.separator}${year}`;
37
+ return `${day}${formats.separator}${month}${formats.separator}${year}`;
38
38
  };
39
39
 
40
40
  export const formatInputTime = (time, format, input) => {
@@ -71,7 +71,8 @@ import handleNotificationActions from "src/decidim/notifications_actions"
71
71
  import RemoteModal from "src/decidim/remote_modal"
72
72
  import selectActiveIdentity from "src/decidim/identity_selector_dialog"
73
73
  import createTooltip from "src/decidim/tooltips"
74
- import fetchRemoteTooltip from "src/decidim/remote_tooltips"
74
+ // Temporary disabling this feature because we have a poor performance. See https://github.com/decidim/decidim/issues/14431
75
+ // import fetchRemoteTooltip from "src/decidim/remote_tooltips"
75
76
  import createToggle from "src/decidim/toggle"
76
77
  import {
77
78
  createAccordion,
@@ -202,7 +203,8 @@ const initializer = (element = document) => {
202
203
  // Initialize data-toggles
203
204
  element.querySelectorAll("[data-toggle]").forEach((elem) => createToggle(elem))
204
205
 
205
- element.querySelectorAll("[data-remote-tooltip]").forEach((elem) => fetchRemoteTooltip(elem))
206
+ // Temporary disabling this feature because we have a poor performance. See https://github.com/decidim/decidim/issues/14431
207
+ // element.querySelectorAll("[data-remote-tooltip]").forEach((elem) => fetchRemoteTooltip(elem))
206
208
 
207
209
  element.querySelectorAll(".new_report").forEach((elem) => changeReportFormBehavior(elem))
208
210
 
@@ -27,6 +27,10 @@
27
27
  @apply block;
28
28
  }
29
29
  }
30
+
31
+ > h3:not([class~="not-prose"]) {
32
+ @apply mb-[-0.4rem] pt-4 pb-2;
33
+ }
30
34
  }
31
35
 
32
36
  &__span {
@@ -167,7 +167,7 @@ header {
167
167
  }
168
168
 
169
169
  &__item {
170
- @apply relative;
170
+ @apply flex relative;
171
171
  }
172
172
 
173
173
  &__search {
@@ -434,8 +434,12 @@ header {
434
434
  @apply h4 md:h3;
435
435
  }
436
436
 
437
+ nav {
438
+ @apply w-full md:w-1/4;
439
+ }
440
+
437
441
  &__menu {
438
- @apply w-full md:w-1/4 bg-primary px-4 md:px-8 pt-0 pb-3 md:py-3 divide-y divide-gray-3 text-white;
442
+ @apply w-full bg-primary px-4 md:px-8 pt-0 pb-3 md:py-3 divide-y divide-gray-3 text-white;
439
443
 
440
444
  > * {
441
445
  @apply py-3 md:py-3.5;
@@ -46,6 +46,7 @@ module Decidim
46
46
  # Returns an HTML-safe String.
47
47
  def present_user
48
48
  return h.content_tag(:span, present_user_name, class: "logs__log__author") if user.blank?
49
+ return I18n.t("decidim.profile.deleted") if user.respond_to?(:deleted?) && user.deleted?
49
50
 
50
51
  h.link_to(
51
52
  present_user_name,
@@ -37,7 +37,7 @@ module Decidim
37
37
  return default_avatar_url if __getobj__.blocked?
38
38
  return default_avatar_url unless avatar.attached?
39
39
 
40
- avatar.path(variant:)
40
+ avatar.url(variant:)
41
41
  end
42
42
 
43
43
  def default_avatar_url
@@ -41,6 +41,8 @@ module Decidim
41
41
  end
42
42
 
43
43
  def parse_i18n_changeset(attribute, values, type, diff)
44
+ return diff unless values.last.is_a?(Hash)
45
+
44
46
  (values.last.keys - ["machine_translations"]).each do |locale, _value|
45
47
  first_value = values.first.try(:[], locale)
46
48
  last_value = values.last.try(:[], locale)
@@ -1,9 +1,25 @@
1
1
  <p class="email-greeting"><%= t(".hello", name: @user.name) %></p>
2
2
 
3
3
  <p class="email-instructions">
4
- <%= t(".report_html", url: reported_content_url ) %>
4
+ <%= t(".report_html", url: report_url ) %>
5
5
  </p>
6
6
 
7
+ <p><b><%= t(".participatory_space") %></b></p>
8
+ <p><%= link_to translated_attribute(@participatory_space.title), resource_locator(@participatory_space).url %></p>
9
+
10
+ <p><b><%= t(".reason") %></b></p>
11
+ <p><%= t(@report.reason, organization_name: organization_name(@participatory_space.organization), scope: "decidim.shared.flag_modal") %></p>
12
+
13
+ <% if @report.details.present? %>
14
+ <p><b><%= t(".details") %></b></p>
15
+ <blockquote>
16
+ <%= @report.details %>
17
+ </blockquote>
18
+ <% end %>
19
+
20
+ <p><b><%= t(".content") %></b></p>
21
+ <%= reported_content_cell %>
22
+
7
23
  <p class="email-button email-button__cta">
8
24
  <%= link_to t(".manage_moderations"), manage_moderations_url %>
9
25
  </p>
@@ -1,7 +1,7 @@
1
1
  <p class="email-greeting"><%= t(".hello", name: @user.name) %></p>
2
2
 
3
3
  <p class="email-instructions">
4
- <%= t(".report_html", url: reported_content_url) %>
4
+ <%= t(".report_html", url: report_url) %>
5
5
  </p>
6
6
 
7
7
  <br>
@@ -15,6 +15,6 @@
15
15
  <% end %>
16
16
  </div>
17
17
 
18
- <h1 class="h3 decorator mb-10 md:my-10">
18
+ <h1 id="search-results-title" class="h3 decorator mb-10 md:my-10">
19
19
  <%= t("decidim.search.results_found_for_term", count: @results_count, term:) %>
20
20
  </h1>
@@ -1,44 +1,46 @@
1
- <div class="filter-container search__filter">
2
- <button id="dropdown-trigger-search" data-component="dropdown" data-target="dropdown-menu-search" data-auto-close="true">
3
- <%= content_tag :span, t("decidim.searches.filters_small_view.filter_by"), class: "#{"is-active" if params.dig(:filter, :with_resource_type) == nil}" %>
4
- <% @blocks.each do |elements| %>
5
- <% elements.each do |type, results| %>
6
- <%= content_tag :span, class: "#{"is-active" if params.dig(:filter, :with_resource_type) == type}" do %>
7
- <span><%= searchable_resource_human_name(type) %></span>
1
+ <nav role="navigation" aria-labelledby="search-results-title">
2
+ <div class="filter-container search__filter">
3
+ <button id="dropdown-trigger-search" data-component="dropdown" data-target="dropdown-menu-search" data-auto-close="true">
4
+ <%= content_tag :span, t("decidim.searches.filters_small_view.filter_by"), class: "#{"is-active" if params.dig(:filter, :with_resource_type) == nil}" %>
5
+ <% @blocks.each do |elements| %>
6
+ <% elements.each do |type, results| %>
7
+ <%= content_tag :span, class: "#{"is-active" if params.dig(:filter, :with_resource_type) == type}" do %>
8
+ <span><%= searchable_resource_human_name(type) %></span>
9
+ <% end %>
8
10
  <% end %>
9
11
  <% end %>
10
- <% end %>
11
- <%= icon "arrow-down-s-line", class: "w-8 h-8 flex-none text-secondary fill-current" %>
12
- <%= icon "arrow-up-s-line", class: "w-8 h-8 flex-none text-secondary fill-current" %>
13
- </button>
14
- <div id="dropdown-menu-search" aria-hidden="true">
15
- <div>
16
- <%= link_to main_search_path, class: "filter#{" is-active" if params.dig(:filter, :with_resource_type) == nil}" do %>
17
- <%= resource_type_icon("all") %>
18
- <span><%= t("all", scope: "decidim.searches.filters.state") %></span>
19
- <span class="label ml-auto"><%= @results_count %></span>
20
- <% end %>
21
- </div>
22
- <% @blocks.each do |elements| %>
12
+ <%= icon "arrow-down-s-line", class: "w-8 h-8 flex-none text-secondary fill-current" %>
13
+ <%= icon "arrow-up-s-line", class: "w-8 h-8 flex-none text-secondary fill-current" %>
14
+ </button>
15
+ <div id="dropdown-menu-search" aria-hidden="true">
23
16
  <div>
24
- <% elements.each do |type, results| %>
25
- <div>
26
- <% if results[:count].positive? %>
27
- <%= link_to search_path_by_resource_type(type), class: "filter#{" is-active" if params.dig(:filter, :with_resource_type) == type}" do %>
28
- <%= resource_type_icon(type) %>
29
- <span><%= searchable_resource_human_name(type) %></span>
30
- <span class="label ml-auto"><%= results[:count] %></span>
31
- <% end %>
32
- <% else %>
33
- <%= content_tag :div, class: "filter#{" is-empty" if results[:count].zero?}" do %>
34
- <%= resource_type_icon(type) %>
35
- <span><%= searchable_resource_human_name(type) %></span>
36
- <span class="label ml-auto"><%= results[:count] %></span>
37
- <% end %>
38
- <% end %>
39
- </div>
17
+ <%= link_to main_search_path, class: "filter#{" is-active" if params.dig(:filter, :with_resource_type) == nil}" do %>
18
+ <%= resource_type_icon("all") %>
19
+ <span><%= t("all", scope: "decidim.searches.filters.state") %></span>
20
+ <span class="label ml-auto"><%= @results_count %></span>
40
21
  <% end %>
41
22
  </div>
42
- <% end %>
23
+ <% @blocks.each do |elements| %>
24
+ <div>
25
+ <% elements.each do |type, results| %>
26
+ <div>
27
+ <% if results[:count].positive? %>
28
+ <%= link_to search_path_by_resource_type(type), class: "filter#{" is-active" if params.dig(:filter, :with_resource_type) == type}" do %>
29
+ <%= resource_type_icon(type) %>
30
+ <span><%= searchable_resource_human_name(type) %></span>
31
+ <span class="label ml-auto"><%= results[:count] %></span>
32
+ <% end %>
33
+ <% else %>
34
+ <%= content_tag :div, class: "filter#{" is-empty" if results[:count].zero?}" do %>
35
+ <%= resource_type_icon(type) %>
36
+ <span><%= searchable_resource_human_name(type) %></span>
37
+ <span class="label ml-auto"><%= results[:count] %></span>
38
+ <% end %>
39
+ <% end %>
40
+ </div>
41
+ <% end %>
42
+ </div>
43
+ <% end %>
44
+ </div>
43
45
  </div>
44
- </div>
46
+ </nav>
@@ -3,6 +3,6 @@
3
3
  <%= link_to t("layouts.decidim.footer.terms_of_service"), decidim.page_path("terms-of-service") %>
4
4
  </li>
5
5
  <li>
6
- <a href="#" data-dialog-open="dc-modal"><%= t("layouts.decidim.footer.data_consent_settings") %></a>
6
+ <a href="#" role="button" data-dialog-open="dc-modal"><%= t("layouts.decidim.footer.data_consent_settings") %></a>
7
7
  </li>
8
8
  </ul>
@@ -488,7 +488,7 @@ ar:
488
488
  metrics:
489
489
  name: مقاييس المنظمة
490
490
  participatory_space_metrics:
491
- name: المقاييس
491
+ name: المشاركة في الأرقام
492
492
  participatory_space_stats:
493
493
  name: الإحصائيات
494
494
  social_networks_metadata:
@@ -994,7 +994,7 @@ ar:
994
994
  participants:
995
995
  description: عدد المشاركين النشطين في المنظمة
996
996
  object: المشاركين
997
- title: المشاركين
997
+ title: المشاركون
998
998
  reported_users:
999
999
  description: عدد المشاركين المبلّغ عنهم
1000
1000
  user_reports:
@@ -1002,7 +1002,7 @@ ar:
1002
1002
  users:
1003
1003
  description: عدد المشاركين في المنظمة
1004
1004
  object: المشاركين
1005
- title: المشاركين
1005
+ title: المشاركون
1006
1006
  newsletter_mailer:
1007
1007
  newsletter:
1008
1008
  no_reply_notice: تم إرسال هذا البريد الإلكتروني من عنوان بريد إلكتروني للإشعارات لا يستقبل لا بريد إلكتروني وارد. يرجى عدم الرد على هذه الرسالة.
@@ -92,7 +92,7 @@ bg:
92
92
  decidim_with_month_name_short: "%d %b"
93
93
  help:
94
94
  date_format: 'Формат: дд/мм/гггг'
95
- order: д-м-г
95
+ order: d-m-y
96
96
  separator: "/"
97
97
  datetime:
98
98
  distance_in_words:
@@ -539,7 +539,7 @@ bg:
539
539
  metrics:
540
540
  name: Показатели за организацията
541
541
  participatory_space_metrics:
542
- name: Метрики
542
+ name: Индикатори
543
543
  participatory_space_stats:
544
544
  name: Статистики
545
545
  social_networks_metadata:
@@ -25,6 +25,8 @@ bs:
25
25
  hero_settings_form:
26
26
  background_image: Pozadinska slika
27
27
  welcome_text: Tekst dobrodošlice
28
+ participatory_space_metrics:
29
+ name: Metrika
28
30
  stats:
29
31
  name: Statistika organizacije
30
32
  endorsements: