decidim-core 0.31.5 → 0.31.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 +4 -4
- data/app/cells/decidim/amendable/amend_button_card/show.erb +2 -2
- data/app/cells/decidim/author_cell.rb +0 -4
- data/app/cells/decidim/content_blocks/cta_settings_form/show.erb +1 -1
- data/app/cells/decidim/content_blocks/hero_settings_form/show.erb +2 -2
- data/app/cells/decidim/content_blocks/highlighted_content_banner_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/highlighted_content_banner_settings_form/show.erb +1 -1
- data/app/cells/decidim/content_blocks/highlighted_participatory_spaces_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form/show.erb +1 -1
- data/app/cells/decidim/content_blocks/static_page/section_settings_form/show.erb +3 -1
- data/app/cells/decidim/content_blocks/static_page/summary_settings_form/show.erb +3 -1
- data/app/cells/decidim/content_blocks/static_page/two_pane_section_settings_form/show.erb +4 -2
- data/app/cells/decidim/resource_types_filter/show.erb +2 -2
- data/app/commands/decidim/destroy_account.rb +12 -1
- data/app/commands/decidim/multiple_attachments_methods.rb +28 -27
- data/app/controllers/concerns/decidim/devise_controllers.rb +10 -0
- data/app/jobs/decidim/process_inactive_participant_job.rb +0 -7
- data/app/mailers/decidim/delete_user_mailer.rb +14 -0
- data/app/mailers/decidim/participants_account_mailer.rb +0 -16
- data/app/models/decidim/moderation.rb +1 -1
- data/app/models/decidim/participatory_space_private_user.rb +1 -1
- data/app/models/decidim/user_base_entity.rb +17 -2
- data/app/models/decidim/user_moderation.rb +1 -1
- data/app/packs/src/decidim/controllers/form_validator/form_validator.js +6 -6
- data/app/packs/src/decidim/controllers/form_validator/form_validator.test.js +23 -1
- data/app/packs/src/decidim/controllers/mention/controller.js +296 -140
- data/app/packs/src/decidim/controllers/mention/input_mentions.test.js +120 -457
- data/app/packs/src/decidim/controllers/multiple_mentions/controller.js +68 -32
- data/app/packs/src/decidim/controllers/multiple_mentions/input_multiple_mentions.test.js +30 -23
- data/app/packs/src/decidim/direct_uploads/upload_field.js +4 -4
- data/app/packs/src/decidim/direct_uploads/upload_modal.js +11 -7
- data/app/packs/src/decidim/geocoding/reverse_geocoding.js +15 -5
- data/app/packs/src/decidim/geocoding/reverse_geocoding.test.js +197 -0
- data/app/packs/src/decidim/index.js +4 -3
- data/app/packs/src/decidim/sw/sw.js +1 -1
- data/app/packs/src/decidim/utilities/text.js +6 -6
- data/app/packs/stylesheets/decidim/_conversations.scss +14 -0
- data/app/packs/stylesheets/decidim/_editor_suggestions.scss +49 -0
- data/app/packs/stylesheets/decidim/_floating_help.scss +1 -1
- data/app/packs/stylesheets/decidim/_tom_select.scss +23 -0
- data/app/packs/stylesheets/decidim/application.scss +2 -0
- data/app/packs/stylesheets/decidim/editor.scss +2 -33
- data/app/packs/stylesheets/decidim/geocoding_addons.scss +10 -2
- data/app/presenters/decidim/menu_item_presenter.rb +9 -3
- data/app/presenters/decidim/stats_presenter.rb +1 -1
- data/app/uploaders/decidim/image_uploader.rb +1 -1
- data/app/views/decidim/delete_user_mailer/delete.html.erb +6 -0
- data/app/views/decidim/gamification/badges/index.html.erb +1 -1
- data/app/views/decidim/homepage/show.html.erb +1 -1
- data/app/views/decidim/last_activities/index.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_error_modal.html.erb +11 -19
- data/app/views/decidim/messaging/conversations/error.js.erb +12 -7
- data/app/views/decidim/newsletters/unsubscribe.html.erb +1 -1
- data/app/views/decidim/offline/show.html.erb +1 -1
- data/app/views/decidim/pages/index.html.erb +1 -1
- data/app/views/decidim/profiles/show.html.erb +1 -1
- data/app/views/decidim/shared/_resource_actions.html.erb +4 -4
- data/app/views/decidim/user_activities/index.html.erb +1 -1
- data/app/views/layouts/decidim/_wrapper.html.erb +2 -2
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +1 -1
- data/app/views/layouts/decidim/shared/_layout_center.html.erb +1 -1
- data/app/views/layouts/decidim/shared/_layout_item.html.erb +1 -1
- data/app/views/layouts/decidim/shared/_layout_two_col.html.erb +1 -1
- data/config/locales/ar.yml +0 -5
- data/config/locales/bg.yml +0 -6
- data/config/locales/ca-IT.yml +9 -10
- data/config/locales/ca.yml +9 -10
- data/config/locales/cs.yml +2 -13
- data/config/locales/de.yml +5 -17
- data/config/locales/el.yml +0 -4
- data/config/locales/en.yml +8 -9
- data/config/locales/es-MX.yml +8 -9
- data/config/locales/es-PY.yml +8 -9
- data/config/locales/es.yml +8 -9
- data/config/locales/eu.yml +48 -49
- data/config/locales/fi-plain.yml +9 -9
- data/config/locales/fi.yml +9 -9
- data/config/locales/fr-CA.yml +9 -9
- data/config/locales/fr.yml +9 -9
- data/config/locales/gl.yml +0 -3
- data/config/locales/hu.yml +0 -5
- data/config/locales/id-ID.yml +0 -3
- data/config/locales/it.yml +1 -3
- data/config/locales/ja.yml +24 -21
- data/config/locales/lb.yml +0 -5
- data/config/locales/lt.yml +0 -5
- data/config/locales/lv.yml +0 -3
- data/config/locales/nl.yml +0 -5
- data/config/locales/no.yml +0 -5
- data/config/locales/pl.yml +2 -8
- data/config/locales/pt-BR.yml +2 -15
- data/config/locales/pt.yml +0 -5
- data/config/locales/ro-RO.yml +1 -14
- data/config/locales/sk.yml +1 -14
- data/config/locales/sv.yml +2 -11
- data/config/locales/tr-TR.yml +0 -6
- data/config/locales/zh-CN.yml +0 -5
- data/config/locales/zh-TW.yml +0 -5
- data/lib/decidim/api/functions/user_entity_list.rb +2 -0
- data/lib/decidim/attachment_attributes.rb +58 -9
- data/lib/decidim/command.rb +1 -1
- data/lib/decidim/content_renderers/base_renderer.rb +112 -0
- data/lib/decidim/content_renderers/blob_renderer.rb +4 -7
- data/lib/decidim/content_renderers/mention_resource_renderer.rb +10 -6
- data/lib/decidim/content_renderers/resource_renderer.rb +16 -7
- data/lib/decidim/content_renderers/user_renderer.rb +11 -9
- data/lib/decidim/core/content_blocks/registry_manager.rb +4 -4
- data/lib/decidim/core/engine.rb +8 -0
- data/lib/decidim/core/test/factories.rb +3 -0
- data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +10 -10
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +6 -6
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/map/autocomplete.rb +4 -3
- data/lib/decidim/searchable.rb +5 -0
- data/lib/decidim/view_model.rb +1 -1
- data/lib/tasks/decidim_mailers_tasks.rake +31 -9
- metadata +11 -10
- data/app/commands/decidim/gallery_methods.rb +0 -107
- data/app/packs/src/decidim/vendor/tribute.js +0 -1890
- data/app/packs/stylesheets/decidim/_tribute.scss +0 -36
- data/app/views/decidim/participants_account_mailer/removal_notification.html.erb +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1625dd1f860a4431caaae18f96ec93ee1751d8d135bde4da819eddbf4976e0d3
|
|
4
|
+
data.tar.gz: ff6293ab292f7c3a18d663a524a099754d63c59dbc4d15e81ca7664f6fc74bff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4403452ffb2df3d9ef2c5c1dd911321cffcfcfaa89ab1d4bf1b32542acc6a2a3e15ad6410a23538bd98cb33ec57496d58de2015022f3a1ce52f77a901d776d99
|
|
7
|
+
data.tar.gz: c385ae7331b4c38b6a2b3a0679340e4739ee9da30535daea878690279776b68e1b5652951bc2151b06959935343a56dd0cbd0d7e066ccc97329dcf4712694862
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<li role="
|
|
2
|
-
<%= action_authorized_link_to :amend, new_amend_path, resource: model, data: { "redirect_url" => new_amend_path }, id: "amend-button", class: "dropdown__button" do %>
|
|
1
|
+
<li role="presentation" class="dropdown__item">
|
|
2
|
+
<%= action_authorized_link_to :amend, new_amend_path, resource: model, data: { "redirect_url" => new_amend_path }, id: "amend-button", class: "dropdown__button", role: "menuitem" do %>
|
|
3
3
|
<span><%= t("button", scope: "decidim.amendments.amendable", model_name: nil) %></span>
|
|
4
4
|
<%= icon "pencil-line" %>
|
|
5
5
|
<% end %>
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
<%= settings_fields.translated :text_field, :description, label: t("decidim.content_blocks.cta_settings_form.description") %>
|
|
5
5
|
<% end %>
|
|
6
6
|
|
|
7
|
-
<% form.fields_for :images,
|
|
7
|
+
<% form.fields_for :images, content_block.images_container do |images_fields| %>
|
|
8
8
|
<%= images_fields.upload :background_image, label: t("decidim.content_blocks.cta_settings_form.background_image") %>
|
|
9
9
|
<% end %>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
<div class="row column" data-controller="slug">
|
|
7
7
|
<%= settings_fields.translated :text_field, :cta_button_path, label: t(".cta_button_path") %>
|
|
8
|
-
<p class="help-text"><%= t(".cta_button_path_help", url: decidim_form_slug_url("", translated_attribute(form.object.settings
|
|
8
|
+
<p class="help-text"><%= t(".cta_button_path_help", url: decidim_form_slug_url("", translated_attribute(form.object.settings["cta_button_path"]))) %></p>
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
11
|
<div class="row column">
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</div>
|
|
15
15
|
<% end %>
|
|
16
16
|
|
|
17
|
-
<% form.fields_for :images,
|
|
17
|
+
<% form.fields_for :images, content_block.images_container do |images_fields| %>
|
|
18
18
|
<div class="row column">
|
|
19
19
|
<%= images_fields.upload :background_image, label: t(".background_image"), button_class: "button button__sm button__transparent-secondary" %>
|
|
20
20
|
</div>
|
|
@@ -32,7 +32,7 @@ module Decidim
|
|
|
32
32
|
private
|
|
33
33
|
|
|
34
34
|
def render?
|
|
35
|
-
required_keys = [:title, :
|
|
35
|
+
required_keys = [:title, :action_button_title, :action_button_subtitle, :action_button_url]
|
|
36
36
|
required_keys.all? { |key| model.settings.public_send(key).present? }
|
|
37
37
|
end
|
|
38
38
|
end
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
</div>
|
|
21
21
|
<% end %>
|
|
22
22
|
|
|
23
|
-
<% form.fields_for :images,
|
|
23
|
+
<% form.fields_for :images, content_block.images_container do |images_fields| %>
|
|
24
24
|
<div class="row column">
|
|
25
25
|
<%= images_fields.upload :background_image, label: t(".background_image"), button_class: "button button__sm button__transparent-secondary" %>
|
|
26
26
|
</div>
|
|
@@ -28,7 +28,7 @@ module Decidim
|
|
|
28
28
|
private
|
|
29
29
|
|
|
30
30
|
def cache_hash
|
|
31
|
-
[I18n.locale, highlighted_spaces.map(&:cache_key_with_version)].join(Decidim.cache_key_separator)
|
|
31
|
+
[I18n.locale, model.cache_key_with_version, highlighted_spaces.map(&:cache_key_with_version)].join(Decidim.cache_key_separator)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def section_class
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
</div>
|
|
9
9
|
<% end %>
|
|
10
10
|
|
|
11
|
-
<% form.fields_for :images,
|
|
11
|
+
<% form.fields_for :images, content_block.images_container do |images_fields| %>
|
|
12
12
|
<div class="row column">
|
|
13
13
|
<%= images_fields.upload :background_image, label: t("decidim.content_blocks.cta_settings_form.background_image"), button_class: "button button__sm button__transparent-secondary" %>
|
|
14
14
|
</div>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<% form.fields_for :settings, form.object.settings do |settings_fields| %>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
<div class="row column">
|
|
3
|
+
<%= settings_fields.translated :editor, :left_column, label: label_left_column %>
|
|
4
|
+
<%= settings_fields.translated :editor, :right_column, label: label_right_column %>
|
|
5
|
+
</div>
|
|
4
6
|
<% end %>
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
</button>
|
|
11
11
|
<ul id="dropdown-menu-resource">
|
|
12
12
|
<% resource_types.each do |resource_type| %>
|
|
13
|
-
<li role="
|
|
14
|
-
<%= link_to filter_url(resource_type[0]), class: "filter#{" is-active" if filter_param == resource_type[0]}" do %>
|
|
13
|
+
<li role="presentation">
|
|
14
|
+
<%= link_to filter_url(resource_type[0]), class: "filter#{" is-active" if filter_param == resource_type[0]}", role: "menuitem" do %>
|
|
15
15
|
<span class="sr-only"><%= resource_type[1] %></span>
|
|
16
16
|
<%= text_with_resource_icon(*resource_type) %>
|
|
17
17
|
<% end %>
|
|
@@ -15,7 +15,7 @@ module Decidim
|
|
|
15
15
|
def call
|
|
16
16
|
return broadcast(:invalid) unless @form.valid?
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
with_events(with_transaction: true) do
|
|
19
19
|
destroy_user_account!
|
|
20
20
|
destroy_user_identities
|
|
21
21
|
destroy_follows
|
|
@@ -110,5 +110,16 @@ module Decidim
|
|
|
110
110
|
space_manifest.invoke_on_destroy_account(current_user)
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
|
+
|
|
114
|
+
# We use memoization in this particular email, as we want to have the data available before the actual anonymization
|
|
115
|
+
def event_arguments
|
|
116
|
+
@event_arguments ||= {
|
|
117
|
+
user_id: current_user.id,
|
|
118
|
+
user_email: current_user.email,
|
|
119
|
+
user_name: current_user.name,
|
|
120
|
+
locale: current_user.locale,
|
|
121
|
+
organization: current_user.organization
|
|
122
|
+
}
|
|
123
|
+
end
|
|
113
124
|
end
|
|
114
125
|
end
|
|
@@ -5,16 +5,16 @@ module Decidim
|
|
|
5
5
|
private
|
|
6
6
|
|
|
7
7
|
def build_attachments
|
|
8
|
-
@
|
|
9
|
-
@form.
|
|
8
|
+
@attachments = []
|
|
9
|
+
@form.add_attachments.compact_blank.each do |attachment|
|
|
10
10
|
if attachment.is_a?(Hash) && attachment.has_key?(:id)
|
|
11
11
|
update_attachment_title_for(attachment)
|
|
12
12
|
next
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
@
|
|
15
|
+
@attachments << Attachment.new(
|
|
16
16
|
title: title_for(attachment),
|
|
17
|
-
attached_to: @attached_to ||
|
|
17
|
+
attached_to: @attached_to || attachments_attached_to,
|
|
18
18
|
file: signed_id_for(attachment),
|
|
19
19
|
content_type: content_type_for(attachment)
|
|
20
20
|
)
|
|
@@ -26,11 +26,11 @@ module Decidim
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def attachments_invalid?
|
|
29
|
-
@
|
|
30
|
-
next if
|
|
29
|
+
@attachments.each do |attachment|
|
|
30
|
+
next if attachment.valid? || !attachment.errors.has_key?(:file)
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
@form.errors.add(:
|
|
32
|
+
attachment.errors[:file].each do |error|
|
|
33
|
+
@form.errors.add(:add_attachments, error)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
return true
|
|
@@ -41,37 +41,38 @@ module Decidim
|
|
|
41
41
|
|
|
42
42
|
def create_attachments(first_weight: 0)
|
|
43
43
|
weight = first_weight
|
|
44
|
-
# Add the weights first to the old
|
|
45
|
-
|
|
46
|
-
Decidim::Attachment.where(id:
|
|
47
|
-
|
|
44
|
+
# Add the weights first to the old attachments
|
|
45
|
+
attachment_ids = keep_ids
|
|
46
|
+
Decidim::Attachment.where(id: attachment_ids).each do |attachment|
|
|
47
|
+
attachment.update!(weight:)
|
|
48
48
|
weight += 1
|
|
49
49
|
end
|
|
50
|
-
@
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
@attachments.map! do |attachment|
|
|
51
|
+
attachment.weight = weight
|
|
52
|
+
attachment.attached_to = attachments_attached_to
|
|
53
|
+
attachment.save!
|
|
54
54
|
weight += 1
|
|
55
|
-
@form.
|
|
55
|
+
@form.attachments << attachment
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
def
|
|
60
|
-
|
|
59
|
+
def attachment_cleanup!(include_all_attachments: false)
|
|
60
|
+
attachments = include_all_attachments ? attachments_attached_to.attachments.with_attached_file : attachments_attached_to.attachments
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
attachments.each do |attachment|
|
|
63
|
+
attachment.destroy! unless keep_ids.include?(attachment.id)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
attachments_attached_to.reload
|
|
67
|
+
attachments_attached_to.instance_variable_set(:@attachments, nil)
|
|
68
|
+
attachments_attached_to.instance_variable_set(:@photos, nil)
|
|
68
69
|
end
|
|
69
70
|
|
|
70
71
|
def process_attachments?
|
|
71
|
-
@form.
|
|
72
|
+
@form.add_attachments.any?
|
|
72
73
|
end
|
|
73
74
|
|
|
74
|
-
def
|
|
75
|
+
def attachments_attached_to
|
|
75
76
|
return @attached_to if @attached_to.present?
|
|
76
77
|
return form.current_organization if form.respond_to?(:current_organization)
|
|
77
78
|
|
|
@@ -101,8 +102,8 @@ module Decidim
|
|
|
101
102
|
end
|
|
102
103
|
|
|
103
104
|
def keep_ids
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
attachments_array = Array(@form.attachments)
|
|
106
|
+
attachments_array.map do |doc|
|
|
106
107
|
case doc
|
|
107
108
|
when Decidim::Attachment
|
|
108
109
|
doc.id
|
|
@@ -41,6 +41,10 @@ module Decidim
|
|
|
41
41
|
|
|
42
42
|
layout "layouts/decidim/application"
|
|
43
43
|
|
|
44
|
+
# Ensure locale is set before Devise's own prepended callbacks and reset
|
|
45
|
+
# after the request finishes.
|
|
46
|
+
prepend_around_action :set_current_locale
|
|
47
|
+
|
|
44
48
|
# Saves the location before loading each page so we can return to the
|
|
45
49
|
# right page.
|
|
46
50
|
before_action :store_current_location
|
|
@@ -58,6 +62,12 @@ module Decidim
|
|
|
58
62
|
|
|
59
63
|
store_location_for(:user, redirect_url)
|
|
60
64
|
end
|
|
65
|
+
|
|
66
|
+
def set_current_locale(&)
|
|
67
|
+
locale = detect_locale
|
|
68
|
+
locale = default_locale unless available_locales.include?(locale)
|
|
69
|
+
I18n.with_locale(locale, &)
|
|
70
|
+
end
|
|
61
71
|
end
|
|
62
72
|
end
|
|
63
73
|
end
|
|
@@ -31,13 +31,6 @@ module Decidim
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def process_remove_user(user)
|
|
34
|
-
email = user.email
|
|
35
|
-
name = user.name
|
|
36
|
-
locale = user.locale
|
|
37
|
-
organization = user.organization
|
|
38
|
-
|
|
39
|
-
ParticipantsAccountMailer.removal_notification(email, name, locale, organization).deliver_later
|
|
40
|
-
|
|
41
34
|
Decidim::DestroyAccount.call(
|
|
42
35
|
Decidim::DeleteAccountForm.from_params(
|
|
43
36
|
delete_reason: I18n.t("decidim.account.destroy.inactive_account_removal_reason", inactivity_period: Decidim.delete_inactive_users_after_days)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
class DeleteUserMailer < ApplicationMailer
|
|
5
|
+
# This email is being sent when a user deletes his own account, or when the user was inactive for too long.
|
|
6
|
+
def delete(user_email:, user_name:, locale:, organization:)
|
|
7
|
+
I18n.with_locale(locale) do
|
|
8
|
+
@user_name = user_name
|
|
9
|
+
@organization = organization
|
|
10
|
+
mail(to: user_email, subject: I18n.t("decidim.delete_user_mailer.subject"))
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -18,21 +18,5 @@ module Decidim
|
|
|
18
18
|
mail(to: user.email, subject:)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
|
-
|
|
22
|
-
# Notify user about account removal due to inactivity
|
|
23
|
-
def removal_notification(email, name, locale, organization)
|
|
24
|
-
@email = email
|
|
25
|
-
@user_name = name
|
|
26
|
-
@organization = organization
|
|
27
|
-
|
|
28
|
-
I18n.with_locale(locale) do
|
|
29
|
-
subject = I18n.t(
|
|
30
|
-
"decidim.participants_account_mailer.removal_notification.subject",
|
|
31
|
-
organization_name: organization_name(@organization)
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
mail(to: email, subject:)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
21
|
end
|
|
38
22
|
end
|
|
@@ -32,7 +32,7 @@ module Decidim
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def self.ransackable_attributes(_auth_object = nil)
|
|
35
|
-
%w(reported_id_string reported_content created_at)
|
|
35
|
+
%w(reported_id_string reported_content created_at report_count)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def self.ransackable_associations(_auth_object = nil)
|
|
@@ -39,7 +39,7 @@ module Decidim
|
|
|
39
39
|
def self.ransackable_attributes(auth_object = nil)
|
|
40
40
|
return [] unless auth_object&.admin?
|
|
41
41
|
|
|
42
|
-
%w(name nickname email invitation_accepted_at last_sign_in_at invitation_sent_at role)
|
|
42
|
+
%w(name nickname email invitation_accepted_at last_sign_in_at invitation_sent_at role published)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def self.ransackable_associations(_auth_object = nil)
|
|
@@ -69,12 +69,27 @@ module Decidim
|
|
|
69
69
|
Decidim::UserBaseEntity.joins(:follows).where(decidim_follows: { user: self }).blocked.exists?
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
+
ransacker :role do
|
|
73
|
+
Arel.sql(%{CASE WHEN "decidim_users"."admin" = true THEN 'admin' ELSE cast("decidim_users"."roles" as text) END})
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
ransacker :user_moderation_report_count do
|
|
77
|
+
query = <<~SQL.squish
|
|
78
|
+
(
|
|
79
|
+
SELECT COALESCE(MAX(decidim_user_moderations.report_count), 0)
|
|
80
|
+
FROM decidim_user_moderations
|
|
81
|
+
WHERE decidim_user_moderations.decidim_user_id = decidim_users.id
|
|
82
|
+
)
|
|
83
|
+
SQL
|
|
84
|
+
Arel.sql(query)
|
|
85
|
+
end
|
|
86
|
+
|
|
72
87
|
def self.ransackable_attributes(auth_object = nil)
|
|
73
|
-
base = %w(name email nickname last_sign_in_at)
|
|
88
|
+
base = %w(name email nickname last_sign_in_at created_at)
|
|
74
89
|
|
|
75
90
|
return base unless auth_object&.admin?
|
|
76
91
|
|
|
77
|
-
base + %w(invitation_sent_at invitation_accepted_at officialized_at)
|
|
92
|
+
base + %w(invitation_sent_at invitation_accepted_at officialized_at role user_moderation_report_count)
|
|
78
93
|
end
|
|
79
94
|
|
|
80
95
|
def self.ransackable_associations(_auth_object = nil)
|
|
@@ -419,13 +419,13 @@ class FormValidator {
|
|
|
419
419
|
return true;
|
|
420
420
|
}
|
|
421
421
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
422
|
+
if (isValid) {
|
|
423
|
+
this.removeCheckboxGroupErrorClasses(groupName);
|
|
424
|
+
} else {
|
|
425
|
+
checkboxGroup.forEach((checkboxElement) => {
|
|
426
426
|
this.addInputErrorClasses(checkboxElement, ["required"]);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
429
|
|
|
430
430
|
return isValid;
|
|
431
431
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* eslint max-lines: ["error",
|
|
1
|
+
/* eslint max-lines: ["error", 712] */
|
|
2
2
|
/* global jest */
|
|
3
3
|
/**
|
|
4
4
|
* @jest-environment jsdom
|
|
@@ -253,6 +253,28 @@ describe("FormValidator", () => {
|
|
|
253
253
|
const isValidTwo = validatorInstance.validateCheckboxGroup("multiCheckboxes");
|
|
254
254
|
expect(isValidTwo).toBe(true);
|
|
255
255
|
});
|
|
256
|
+
|
|
257
|
+
it("should remove error classes once for the group, not per checkbox", () => {
|
|
258
|
+
formElement.innerHTML = `
|
|
259
|
+
<fieldset>
|
|
260
|
+
<input type="checkbox" id="cb-1" name="largeGroup" value="1" required>
|
|
261
|
+
<input type="checkbox" id="cb-2" name="largeGroup" value="2" required>
|
|
262
|
+
<input type="checkbox" id="cb-3" name="largeGroup" value="3" required>
|
|
263
|
+
</fieldset>
|
|
264
|
+
<button type="submit">Submit</button>
|
|
265
|
+
`;
|
|
266
|
+
validatorInstance = new FormValidator(formElement);
|
|
267
|
+
formElement.querySelector("#cb-1").checked = true;
|
|
268
|
+
|
|
269
|
+
const removeGroupSpy = jest.spyOn(validatorInstance, "removeCheckboxGroupErrorClasses");
|
|
270
|
+
const removeInputSpy = jest.spyOn(validatorInstance, "removeInputErrorClasses");
|
|
271
|
+
|
|
272
|
+
const isValid = validatorInstance.validateCheckboxGroup("largeGroup");
|
|
273
|
+
|
|
274
|
+
expect(isValid).toBe(true);
|
|
275
|
+
expect(removeGroupSpy).toHaveBeenCalledTimes(1);
|
|
276
|
+
expect(removeInputSpy).not.toHaveBeenCalled();
|
|
277
|
+
});
|
|
256
278
|
});
|
|
257
279
|
|
|
258
280
|
describe("Custom Validators", () => {
|