decidim-core 0.29.1 → 0.29.3
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/activity_cell.rb +0 -3
- data/app/cells/decidim/author/show.erb +5 -4
- data/app/cells/decidim/author_cell.rb +26 -0
- data/app/cells/decidim/card_s/show.erb +5 -3
- data/app/cells/decidim/diff_cell.rb +4 -0
- data/app/cells/decidim/newsletter_templates/image_text_cta_cell.rb +1 -1
- data/app/cells/decidim/participatory_space_dropdown_metadata/show.erb +5 -3
- data/app/cells/decidim/profile_actions/show.erb +1 -1
- data/app/cells/decidim/report_button/already_reported_modal.erb +2 -2
- data/app/cells/decidim/report_button/flag_modal.erb +13 -27
- data/app/cells/decidim/report_button_cell.rb +2 -8
- data/app/cells/decidim/report_user_button/already_reported_modal.erb +11 -0
- data/app/cells/decidim/report_user_button/flag_modal.erb +46 -0
- data/app/cells/decidim/report_user_button/show.erb +2 -0
- data/app/cells/decidim/report_user_button_cell.rb +59 -0
- data/app/cells/decidim/resource_types_filter/show.erb +1 -1
- data/app/cells/decidim/resource_types_filter_cell.rb +6 -6
- data/app/cells/decidim/translation_bar/show.erb +2 -2
- data/app/cells/decidim/translation_bar_cell.rb +1 -1
- data/app/cells/decidim/user_activity/show.erb +1 -1
- data/app/commands/decidim/create_omniauth_registration.rb +14 -8
- data/app/commands/decidim/create_report.rb +1 -6
- data/app/commands/decidim/destroy_account.rb +3 -0
- data/app/commands/decidim/search.rb +14 -0
- data/app/controllers/decidim/doorkeeper/credentials_controller.rb +1 -1
- data/app/controllers/decidim/links_controller.rb +1 -1
- data/app/controllers/decidim/profiles_controller.rb +6 -2
- data/app/controllers/decidim/reports_controller.rb +1 -1
- data/app/controllers/decidim/user_activities_controller.rb +1 -1
- data/app/forms/decidim/account_form.rb +5 -2
- data/app/helpers/concerns/decidim/user_role_checker.rb +46 -0
- data/app/helpers/decidim/cta_button_helper.rb +1 -1
- data/app/helpers/decidim/map_helper.rb +6 -1
- data/app/helpers/decidim/orders_helper.rb +2 -1
- data/app/helpers/decidim/participatory_space_helpers.rb +1 -1
- data/app/helpers/decidim/sanitize_helper.rb +11 -2
- data/app/jobs/decidim/hide_child_resources_job.rb +24 -0
- data/app/mailers/decidim/reported_mailer.rb +1 -0
- data/app/models/decidim/action_log.rb +1 -9
- data/app/models/decidim/attachment.rb +1 -1
- data/app/models/decidim/report.rb +1 -1
- data/app/models/decidim/user.rb +0 -4
- data/app/models/decidim/user_base_entity.rb +4 -0
- data/app/packs/src/decidim/append_redirect_url_to_modals.js +14 -6
- data/app/packs/src/decidim/datepicker/datepicker_functions.js +3 -3
- data/app/packs/src/decidim/direct_uploads/upload_field.js +21 -8
- data/app/packs/src/decidim/index.js +5 -0
- data/app/packs/src/decidim/map/provider/here.js +1 -1
- data/app/packs/src/decidim/remote_tooltips.js +38 -0
- data/app/packs/src/decidim/toggle.js +1 -1
- data/app/packs/src/decidim/tooltips.js +42 -22
- data/app/packs/stylesheets/decidim/_content_blocks.scss +4 -0
- data/app/packs/stylesheets/decidim/_hashtags.scss +5 -0
- data/app/packs/stylesheets/decidim/_header.scss +11 -5
- data/app/packs/stylesheets/decidim/_labels.scss +1 -1
- data/app/packs/stylesheets/decidim/_profile.scss +1 -1
- data/app/packs/stylesheets/decidim/_progress-bar.scss +1 -1
- data/app/packs/stylesheets/decidim/application.scss +1 -0
- data/app/packs/stylesheets/decidim/legacy/conference-diploma.scss +2 -1
- data/app/presenters/decidim/attachment_presenter.rb +1 -1
- data/app/presenters/decidim/log/user_presenter.rb +1 -0
- data/app/presenters/decidim/user_presenter.rb +1 -1
- data/app/services/decidim/base_diff_renderer.rb +28 -2
- data/app/services/decidim/email_notification_generator.rb +14 -5
- data/app/services/decidim/static_map_generator.rb +1 -1
- data/app/views/decidim/last_activities/index.html.erb +1 -1
- data/app/views/decidim/pages/_tabbed.html.erb +2 -2
- data/app/views/decidim/reported_mailer/hide.html.erb +17 -1
- data/app/views/decidim/reported_mailer/report.html.erb +1 -1
- data/app/views/decidim/searches/_count.html.erb +1 -1
- data/app/views/decidim/searches/_filters.html.erb +40 -38
- data/app/views/decidim/shared/_orders.html.erb +2 -2
- data/app/views/layouts/decidim/footer/_main_legal.html.erb +1 -1
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +1 -1
- data/config/locales/ar.yml +56 -27
- data/config/locales/bg.yml +10 -24
- data/config/locales/bn-BD.yml +1 -0
- data/config/locales/bs-BA.yml +100 -0
- data/config/locales/ca-IT.yml +2111 -0
- data/config/locales/ca.yml +70 -38
- data/config/locales/cs.yml +60 -32
- data/config/locales/de.yml +66 -38
- data/config/locales/el.yml +17 -15
- data/config/locales/en.yml +48 -16
- data/config/locales/eo.yml +2 -0
- data/config/locales/es-MX.yml +61 -29
- data/config/locales/es-PY.yml +66 -34
- data/config/locales/es.yml +71 -39
- data/config/locales/eu.yml +303 -261
- data/config/locales/fi-plain.yml +48 -28
- data/config/locales/fi.yml +85 -65
- data/config/locales/fr-CA.yml +64 -27
- data/config/locales/fr.yml +62 -25
- data/config/locales/ga-IE.yml +13 -4
- data/config/locales/gl.yml +33 -15
- data/config/locales/hu.yml +12 -26
- data/config/locales/id-ID.yml +32 -16
- data/config/locales/is-IS.yml +18 -2
- data/config/locales/it.yml +54 -27
- data/config/locales/ja.yml +70 -38
- data/config/locales/lb.yml +33 -22
- data/config/locales/lt.yml +10 -18
- data/config/locales/lv.yml +26 -15
- data/config/locales/nl.yml +33 -19
- data/config/locales/no.yml +27 -16
- data/config/locales/pl.yml +8 -22
- data/config/locales/pt-BR.yml +13 -25
- data/config/locales/pt.yml +32 -16
- data/config/locales/ro-RO.yml +500 -220
- data/config/locales/ru.yml +31 -8
- data/config/locales/sk.yml +38 -19
- data/config/locales/sl.yml +4 -0
- data/config/locales/sr-CS.yml +2 -0
- data/config/locales/sv.yml +29 -33
- data/config/locales/tr-TR.yml +34 -24
- data/config/locales/uk.yml +20 -3
- data/config/locales/zh-CN.yml +27 -15
- data/config/locales/zh-TW.yml +16 -16
- data/config/routes.rb +1 -0
- data/decidim-core.gemspec +4 -1
- data/lib/decidim/api/functions/component_list.rb +1 -1
- data/lib/decidim/api/functions/participatory_space_finder_base.rb +11 -1
- data/lib/decidim/api/interfaces/participatory_space_interface.rb +1 -1
- data/lib/decidim/api/types/component_type.rb +7 -0
- data/lib/decidim/api/types/user_group_type.rb +4 -0
- data/lib/decidim/api/types/user_type.rb +4 -0
- data/lib/decidim/asset_router/storage.rb +7 -2
- data/lib/decidim/attributes/rich_text.rb +38 -0
- data/lib/decidim/attributes/time_with_zone.rb +16 -2
- data/lib/decidim/attributes.rb +2 -0
- data/lib/decidim/content_parsers/blob_parser.rb +95 -0
- data/lib/decidim/content_parsers/user_parser.rb +1 -1
- data/lib/decidim/content_parsers.rb +1 -0
- data/lib/decidim/content_renderers/blob_renderer.rb +90 -0
- data/lib/decidim/content_renderers.rb +1 -0
- data/lib/decidim/core/engine.rb +29 -1
- data/lib/decidim/core/test/factories.rb +28 -0
- data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +15 -2
- data/lib/decidim/core/test/shared_examples/reports_examples.rb +48 -6
- data/lib/decidim/core/test/shared_examples/social_share_examples.rb +32 -0
- data/lib/decidim/core/test/shared_examples/uncommentable_component_examples.rb +26 -0
- data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +26 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/diffy_extension.rb +18 -0
- data/lib/decidim/form_builder.rb +1 -1
- data/lib/decidim/map/autocomplete.rb +1 -0
- data/lib/decidim/map/provider/dynamic_map/here.rb +1 -40
- data/lib/decidim/map/provider/static_map/here.rb +34 -0
- data/lib/decidim/moderation_tools.rb +16 -2
- data/lib/decidim/nicknamizable.rb +1 -1
- data/lib/decidim/participatory_space_user.rb +4 -0
- data/lib/decidim/query_extensions.rb +0 -26
- data/lib/decidim/reportable.rb +6 -2
- data/lib/decidim/settings_manifest.rb +2 -0
- data/lib/decidim/translatable_attributes.rb +10 -1
- data/lib/tasks/upgrade/clean_hidden_resources.rake +33 -0
- data/lib/tasks/upgrade/decidim_fix_categorization.rake +34 -8
- data/lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake +23 -20
- metadata +37 -15
- data/app/cells/decidim/author/flag.erb +0 -6
- data/app/cells/decidim/author/flag_user.erb +0 -14
- data/app/cells/decidim/flag_modal/flag_user.erb +0 -34
- data/app/cells/decidim/flag_modal/show.erb +0 -52
- data/app/cells/decidim/flag_modal_cell.rb +0 -56
- data/app/cells/decidim/profile_sidebar/show.erb +0 -167
- data/app/cells/decidim/profile_sidebar_cell.rb +0 -68
- data/app/packs/src/decidim/vendor/leaflet-tilelayer-here.js +0 -212
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28b3c4ae291bd29e865f8c3d4b18ac88f4e1e28e5f40b658b650c8fbff2773be
|
4
|
+
data.tar.gz: 4e3784db851ce1e0b3c857aba4bfbc4afae28f9b4c0567d071dfaa5bd37aa3eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa92b90aaaee207b64a405dabfc14217e5e10138de033c3a06fcd5261209840a34b28a41efa8139c9c83dea1f0b7bf4ade861058855f575505feb1f3740b2da1
|
7
|
+
data.tar.gz: d2714c0d00b670dc1e7245088175d6a8b1d84f1f34d30234cb55a5834940f53ca14c5c170ae913732d5ee6d6c8de8024c3e5c16e5e1697f8a2c3b3e0f8ee7999
|
@@ -105,9 +105,6 @@ module Decidim
|
|
105
105
|
hash << I18n.locale.to_s
|
106
106
|
hash << model.class.name.underscore
|
107
107
|
hash << model.cache_key_with_version if model.respond_to?(:cache_key_with_version)
|
108
|
-
if (author_cell = author)
|
109
|
-
hash.push(Digest::MD5.hexdigest(author_cell.send(:cache_hash)))
|
110
|
-
end
|
111
108
|
|
112
109
|
hash.join(Decidim.cache_key_separator)
|
113
110
|
end
|
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
<%# If the options hash has the demo key it means we are in the decidim-design engine, so it is not a real-world scenario with actual users %>
|
2
|
+
<% tooltip = options.has_key?(:demo) ? { tooltip: render(:profile_minicard).html_safe } : nil %>
|
3
|
+
<%= content_tag(:span, class: :author, data: ) do %>
|
4
|
+
<%= content_tag :span, class: "author__container#{" is-compact" if layout == :compact}", data: tooltip do %>
|
4
5
|
<% if layout == :compact %>
|
5
6
|
<%= render :avatar %>
|
6
7
|
|
@@ -24,4 +25,4 @@
|
|
24
25
|
<%= render action %>
|
25
26
|
<% end %>
|
26
27
|
<% end %>
|
27
|
-
|
28
|
+
<% end %>
|
@@ -47,8 +47,26 @@ module Decidim
|
|
47
47
|
@context_actions_options ||= options[:context_actions].map(&:to_sym)
|
48
48
|
end
|
49
49
|
|
50
|
+
def profile_minicard
|
51
|
+
render
|
52
|
+
end
|
53
|
+
|
50
54
|
private
|
51
55
|
|
56
|
+
# If the options hash has the demo key it means we are in the decidim-design engine,
|
57
|
+
# so it is not a real-world scenario with actual users
|
58
|
+
def data
|
59
|
+
@data ||= begin
|
60
|
+
internal_data = { author: true }
|
61
|
+
if has_tooltip? && !options.has_key?(:demo)
|
62
|
+
internal_data["remote_tooltip"] = true
|
63
|
+
internal_data["tooltip-url"] = decidim.profile_tooltip_path(raw_model.nickname)
|
64
|
+
end
|
65
|
+
|
66
|
+
internal_data
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
52
70
|
def layout
|
53
71
|
@layout ||= LAYOUTS.include?(options[:layout]) ? options[:layout] : :default
|
54
72
|
end
|
@@ -160,5 +178,13 @@ module Decidim
|
|
160
178
|
def resource_name
|
161
179
|
@resource_name ||= from_context.class.name.demodulize.underscore
|
162
180
|
end
|
181
|
+
|
182
|
+
def has_tooltip?
|
183
|
+
return false if model.deleted?
|
184
|
+
return false if model.respond_to?(:blocked?) && model.blocked?
|
185
|
+
return true if options.has_key?(:tooltip)
|
186
|
+
|
187
|
+
model.has_tooltip?
|
188
|
+
end
|
163
189
|
end
|
164
190
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag :div, id: dom_id(resource), class: "card__search" do %>
|
2
2
|
<%= content_tag title_tag, class: "h4 card__search-title" do %>
|
3
|
-
<%=
|
3
|
+
<%= link_to resource_path, class: "card__search" do %>
|
4
|
+
<%= title %>
|
5
|
+
<% end %>
|
4
6
|
<% end %>
|
5
7
|
<% if metadata_cell.present? %>
|
6
8
|
<div class="card__search-metadata">
|
7
|
-
|
9
|
+
<%= cell metadata_cell, resource, links: false %>
|
8
10
|
</div>
|
9
11
|
<% end %>
|
10
12
|
<% end %>
|
@@ -70,6 +70,10 @@ module Decidim
|
|
70
70
|
|
71
71
|
# DiffRenderer class for the current_version's item; falls back to `BaseDiffRenderer`.
|
72
72
|
def diff_renderer_class
|
73
|
+
renderer_class = "#{current_version.item_type}DiffRenderer".safe_constantize
|
74
|
+
|
75
|
+
return renderer_class if renderer_class
|
76
|
+
|
73
77
|
if current_version.item_type.deconstantize == "Decidim"
|
74
78
|
"#{current_version.item_type.pluralize}::DiffRenderer".constantize
|
75
79
|
else
|
@@ -50,7 +50,7 @@ module Decidim
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def main_image_url
|
53
|
-
newsletter.template.images_container.attached_uploader(:main_image).url
|
53
|
+
newsletter.template.images_container.attached_uploader(:main_image).url
|
54
54
|
end
|
55
55
|
|
56
56
|
def organization_primary_color
|
@@ -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
|
-
<
|
7
|
-
|
8
|
-
|
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>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%= decidim_modal id: modal_id, class: "flag-modal" do %>
|
2
2
|
<div data-dialog-container>
|
3
3
|
<%= icon "flag-line" %>
|
4
|
-
<h2
|
4
|
+
<h2 tabindex="-1" data-dialog-title><%= t("decidim.shared.flag_modal.title") %></h2>
|
5
5
|
<div>
|
6
6
|
<div class="form__wrapper flag-modal__form">
|
7
|
-
<p
|
7
|
+
<p class="flag-modal__form-description"><%= t("decidim.shared.flag_modal.already_reported") %></p>
|
8
8
|
</div>
|
9
9
|
</div>
|
10
10
|
</div>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= form_for report_form, builder:, url: report_path, method: :post, html: { id: nil } do |f| %>
|
3
3
|
<div data-dialog-container>
|
4
4
|
<%= icon "flag-line" %>
|
5
|
-
<h2
|
5
|
+
<h2 tabindex="-1" data-dialog-title><%= t("decidim.shared.flag_modal.title") %></h2>
|
6
6
|
<div>
|
7
7
|
<div class="form__wrapper flag-modal__form">
|
8
8
|
<p id="dialog-desc-<%= modal_id %>" class="flag-modal__form-description"><%= t("decidim.shared.flag_modal.description") %></p>
|
@@ -18,32 +18,18 @@
|
|
18
18
|
<%= f.text_area :details, rows: 4, label_options: { class: "flag-modal__form-textarea-label", for: nil }, id: nil %>
|
19
19
|
|
20
20
|
<% if frontend_administrable? %>
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
<% else %>
|
34
|
-
<%= f.check_box :hide,
|
35
|
-
label: t("decidim.shared.flag_modal.hide_content"),
|
36
|
-
include_hidden: false,
|
37
|
-
id: hide_checkbox_id,
|
38
|
-
data: {
|
39
|
-
label_action: t("decidim.shared.flag_modal.hide"),
|
40
|
-
label_report: t("decidim.shared.flag_modal.report"),
|
41
|
-
hide: "true"
|
42
|
-
},
|
43
|
-
label_options: {
|
44
|
-
for: hide_checkbox_id
|
45
|
-
} %>
|
46
|
-
<% end %>
|
21
|
+
<%= f.check_box :hide,
|
22
|
+
label: t("decidim.shared.flag_modal.hide_content"),
|
23
|
+
include_hidden: false,
|
24
|
+
id: hide_checkbox_id,
|
25
|
+
data: {
|
26
|
+
label_action: t("decidim.shared.flag_modal.hide"),
|
27
|
+
label_report: t("decidim.shared.flag_modal.report"),
|
28
|
+
hide: "true"
|
29
|
+
},
|
30
|
+
label_options: {
|
31
|
+
for: hide_checkbox_id
|
32
|
+
} %>
|
47
33
|
<% end %>
|
48
34
|
|
49
35
|
</div>
|
@@ -11,8 +11,6 @@ module Decidim
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def frontend_administrable?
|
14
|
-
return true if user_reportable? && current_user&.admin?
|
15
|
-
|
16
14
|
user_entity? &&
|
17
15
|
model.can_be_administered_by?(current_user) &&
|
18
16
|
(model.respond_to?(:official?) && !model.official?)
|
@@ -47,16 +45,12 @@ module Decidim
|
|
47
45
|
options[:modal_id] || "flagModal"
|
48
46
|
end
|
49
47
|
|
50
|
-
def user_reportable?
|
51
|
-
model.is_a?(Decidim::UserReportable)
|
52
|
-
end
|
53
|
-
|
54
48
|
def report_form
|
55
|
-
@report_form ||=
|
49
|
+
@report_form ||= Decidim::ReportForm.new(reason: "spam")
|
56
50
|
end
|
57
51
|
|
58
52
|
def report_path
|
59
|
-
@report_path ||=
|
53
|
+
@report_path ||= decidim.report_path(sgid: model.to_sgid.to_s)
|
60
54
|
end
|
61
55
|
|
62
56
|
def builder
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= decidim_modal id: modal_id, class: "flag-user-modal" do %>
|
2
|
+
<div data-dialog-container>
|
3
|
+
<%= icon "flag-line" %>
|
4
|
+
<h2 tabindex="-1" data-dialog-title><%= t("decidim.shared.flag_user_modal.title") %></h2>
|
5
|
+
<div>
|
6
|
+
<div class="form__wrapper flag-modal__form">
|
7
|
+
<p class="flag-modal__form-description"><%= t("decidim.shared.flag_user_modal.already_reported") %></p>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<%= decidim_modal id: modal_id, class: "flag-user-modal" do %>
|
2
|
+
<%= form_for report_form, builder:, url: report_path, method: :post, html: { id: nil } do |f| %>
|
3
|
+
<div data-dialog-container>
|
4
|
+
<%= icon "flag-line" %>
|
5
|
+
<h2 tabindex="-1" data-dialog-title><%= t("decidim.shared.flag_user_modal.title") %></h2>
|
6
|
+
<div>
|
7
|
+
<div class="form__wrapper flag-modal__form">
|
8
|
+
<p class="flag-modal__form-description"><%= t("decidim.shared.flag_user_modal.description") %></p>
|
9
|
+
<p class="flag-modal__form-reason"><%= t("decidim.shared.flag_modal.reason") %>:</p>
|
10
|
+
<%= f.collection_radio_buttons :reason, [
|
11
|
+
[:spam, t("decidim.shared.flag_user_modal.spam")],
|
12
|
+
[:offensive, t("decidim.shared.flag_user_modal.offensive")],
|
13
|
+
[:does_not_belong, t("decidim.shared.flag_user_modal.does_not_belong", organization_name: current_organization_name)]
|
14
|
+
], :first, :last do |builder|
|
15
|
+
builder.label(for: nil, class: "form__wrapper-checkbox-label") { builder.radio_button(id: nil) + builder.text }
|
16
|
+
end %>
|
17
|
+
|
18
|
+
<%= f.text_area :details, rows: 4, label_options: { class: "flag-modal__form-textarea-label", for: nil }, id: nil %>
|
19
|
+
|
20
|
+
<% if frontend_administrable? %>
|
21
|
+
<%= f.check_box :block,
|
22
|
+
label: t("decidim.shared.flag_user_modal.block"),
|
23
|
+
include_hidden: false,
|
24
|
+
data: {
|
25
|
+
label_action: t("decidim.shared.flag_user_modal.block"),
|
26
|
+
label_report: t("decidim.shared.flag_user_modal.report"),
|
27
|
+
block: "true"
|
28
|
+
} %>
|
29
|
+
<%= f.check_box :hide, label: t("decidim.shared.flag_user_modal.hide"), label_options: { class: :invisible, id: "block_and_hide" } %>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div data-dialog-actions>
|
36
|
+
<button type="button" class="button button__lg button__transparent-secondary" data-dialog-close="<%= modal_id %>">
|
37
|
+
<%= t("decidim.shared.confirm_modal.cancel") %>
|
38
|
+
</button>
|
39
|
+
|
40
|
+
<button type="submit" class="button button__lg button__secondary">
|
41
|
+
<span><%= t("decidim.shared.flag_modal.report") %></span>
|
42
|
+
<%= icon "arrow-right-line", class: "fill-current" %>
|
43
|
+
</button>
|
44
|
+
</div>
|
45
|
+
<% end %>
|
46
|
+
<% end %>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class ReportUserButtonCell < ButtonCell
|
5
|
+
include ActionView::Helpers::FormOptionsHelper
|
6
|
+
|
7
|
+
def flag_modal
|
8
|
+
return render :already_reported_modal if model.reported_by?(current_user)
|
9
|
+
|
10
|
+
render
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def report_form
|
16
|
+
@report_form ||= Decidim::ReportForm.from_params(reason: "spam")
|
17
|
+
end
|
18
|
+
|
19
|
+
def report_path
|
20
|
+
@report_path ||= decidim.report_user_path(sgid: model.to_sgid.to_s)
|
21
|
+
end
|
22
|
+
|
23
|
+
def user_reportable?
|
24
|
+
model.is_a?(Decidim::UserReportable)
|
25
|
+
end
|
26
|
+
|
27
|
+
def frontend_administrable?
|
28
|
+
current_user&.admin?
|
29
|
+
end
|
30
|
+
|
31
|
+
def builder
|
32
|
+
Decidim::FormBuilder
|
33
|
+
end
|
34
|
+
|
35
|
+
def only_button?
|
36
|
+
options[:only_button]
|
37
|
+
end
|
38
|
+
|
39
|
+
def modal_id
|
40
|
+
options[:modal_id] || "flagUserModal"
|
41
|
+
end
|
42
|
+
|
43
|
+
def button_classes
|
44
|
+
options[:button_classes] || "button button__sm button__text button__text-secondary"
|
45
|
+
end
|
46
|
+
|
47
|
+
def text
|
48
|
+
t("decidim.shared.flag_modal.report")
|
49
|
+
end
|
50
|
+
|
51
|
+
def icon_name
|
52
|
+
"flag-line"
|
53
|
+
end
|
54
|
+
|
55
|
+
def html_options
|
56
|
+
{ data: { "dialog-open": current_user ? modal_id : "loginModal" } }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<ul id="dropdown-menu-resource">
|
12
12
|
<% resource_types.each do |resource_type| %>
|
13
13
|
<li role="menuitem">
|
14
|
-
<%= link_to
|
14
|
+
<%= link_to filter_url(resource_type[0]), class: "filter#{" is-active" if filter_param == resource_type[0]}" do %>
|
15
15
|
<span class="sr-only"><%= resource_type[1] %></span>
|
16
16
|
<%= text_with_resource_icon(*resource_type) %>
|
17
17
|
<% end %>
|
@@ -27,8 +27,12 @@ module Decidim
|
|
27
27
|
options[:id] || "filters"
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
options[:
|
30
|
+
def filter_url(resource_type)
|
31
|
+
if options[:source] == :last_activities
|
32
|
+
last_activities_path(filter: { with_resource_type: resource_type })
|
33
|
+
else
|
34
|
+
profile_activity_path(nickname: params[:nickname], filter: { resource_type: })
|
35
|
+
end
|
32
36
|
end
|
33
37
|
|
34
38
|
def filter_param_key
|
@@ -39,10 +43,6 @@ module Decidim
|
|
39
43
|
@filter_param ||= params.dig(:filter, filter_param_key) || all_types_key
|
40
44
|
end
|
41
45
|
|
42
|
-
def filter
|
43
|
-
options[:filter]
|
44
|
-
end
|
45
|
-
|
46
46
|
def all_resource_types_option
|
47
47
|
[all_types_key, I18n.t("all", scope: "decidim.last_activities")]
|
48
48
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="profile__activity">
|
2
|
-
<%= cell "decidim/resource_types_filter", resource_types,
|
2
|
+
<%= cell "decidim/resource_types_filter", resource_types, source: :profile_activity %>
|
3
3
|
<div class="profile__activity__container" id="activities-container">
|
4
4
|
<% if activities.length == 0 %>
|
5
5
|
<%= cell "decidim/announcement", t("decidim.user_activity.index.no_activities_warning") %>
|
@@ -45,6 +45,8 @@ module Decidim
|
|
45
45
|
|
46
46
|
attr_reader :form, :verified_email
|
47
47
|
|
48
|
+
REGEXP_SANITIZER = /[<>?%&\^*#@()\[\]=+:;"{}\\|]/
|
49
|
+
|
48
50
|
def create_or_find_user
|
49
51
|
@user = User.find_or_initialize_by(
|
50
52
|
email: verified_email,
|
@@ -63,16 +65,11 @@ module Decidim
|
|
63
65
|
@user.save!
|
64
66
|
else
|
65
67
|
@user.email = (verified_email || form.email)
|
66
|
-
@user.name = form.name
|
68
|
+
@user.name = form.name.gsub(REGEXP_SANITIZER, "")
|
67
69
|
@user.nickname = form.normalized_nickname
|
68
70
|
@user.newsletter_notifications_at = nil
|
69
71
|
@user.password = SecureRandom.hex
|
70
|
-
if form.avatar_url.present?
|
71
|
-
url = URI.parse(form.avatar_url)
|
72
|
-
filename = File.basename(url.path)
|
73
|
-
file = url.open
|
74
|
-
@user.avatar.attach(io: file, filename:)
|
75
|
-
end
|
72
|
+
attach_avatar(form.avatar_url) if form.avatar_url.present?
|
76
73
|
@user.skip_confirmation! if verified_email
|
77
74
|
@user.tos_agreement = "1"
|
78
75
|
@user.save!
|
@@ -81,6 +78,15 @@ module Decidim
|
|
81
78
|
end
|
82
79
|
end
|
83
80
|
|
81
|
+
def attach_avatar(avatar_url)
|
82
|
+
url = URI.parse(avatar_url)
|
83
|
+
filename = File.basename(url.path)
|
84
|
+
file = url.open
|
85
|
+
@user.avatar.attach(io: file, filename:)
|
86
|
+
rescue OpenURI::HTTPError, Errno::ECONNREFUSED
|
87
|
+
# Do not attach the avatar, as it fails to fetch it.
|
88
|
+
end
|
89
|
+
|
84
90
|
def create_identity
|
85
91
|
@user.identities.create!(
|
86
92
|
provider: form.provider,
|
@@ -126,7 +132,7 @@ module Decidim
|
|
126
132
|
provider: form.provider,
|
127
133
|
uid: form.uid,
|
128
134
|
email: form.email,
|
129
|
-
name: form.name,
|
135
|
+
name: form.name.gsub(REGEXP_SANITIZER, ""),
|
130
136
|
nickname: form.normalized_nickname,
|
131
137
|
avatar_url: form.avatar_url,
|
132
138
|
raw_data: form.raw_data
|
@@ -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,9 @@ module Decidim
|
|
37
37
|
current_user.name = ""
|
38
38
|
current_user.nickname = ""
|
39
39
|
current_user.email = ""
|
40
|
+
current_user.personal_url = ""
|
41
|
+
current_user.about = ""
|
42
|
+
current_user.notifications_sending_frequency = "none"
|
40
43
|
current_user.delete_reason = @form.delete_reason
|
41
44
|
current_user.admin = false if current_user.admin?
|
42
45
|
current_user.deleted_at = Time.current
|
@@ -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
|
@@ -28,7 +28,7 @@ module Decidim
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def avatar_url
|
31
|
-
avatar_url = current_resource_owner.attached_uploader(:avatar).url
|
31
|
+
avatar_url = current_resource_owner.attached_uploader(:avatar).url
|
32
32
|
return unless avatar_url
|
33
33
|
|
34
34
|
unless %r{^https?://}.match? avatar_url
|
@@ -41,7 +41,7 @@ module Decidim
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def escape_url(external_url)
|
44
|
-
before_fragment, fragment = external_url.split("#", 2)
|
44
|
+
before_fragment, fragment = URI.decode_www_form_component(external_url).split("#", 2)
|
45
45
|
escaped_before_fragment = URI::Parser.new.escape(before_fragment)
|
46
46
|
|
47
47
|
if fragment
|
@@ -24,7 +24,11 @@ module Decidim
|
|
24
24
|
def show
|
25
25
|
return redirect_to profile_members_path if profile_holder.is_a?(Decidim::UserGroup)
|
26
26
|
|
27
|
-
redirect_to profile_activity_path(nickname: params[:nickname])
|
27
|
+
redirect_to profile_activity_path(nickname: params[:nickname].downcase)
|
28
|
+
end
|
29
|
+
|
30
|
+
def tooltip
|
31
|
+
render json: { data: cell("decidim/author", profile_holder.presenter).profile_minicard }
|
28
32
|
end
|
29
33
|
|
30
34
|
def following
|
@@ -112,7 +116,7 @@ module Decidim
|
|
112
116
|
def profile_holder
|
113
117
|
return if params[:nickname].blank?
|
114
118
|
|
115
|
-
@profile_holder ||= Decidim::UserBaseEntity.find_by("
|
119
|
+
@profile_holder ||= Decidim::UserBaseEntity.find_by("nickname = ? AND decidim_organization_id = ?", params[:nickname].downcase, current_organization.id)
|
116
120
|
end
|
117
121
|
end
|
118
122
|
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
|
-
|
19
|
+
redirect_to reportable.reload.reported_content_url
|
20
20
|
end
|
21
21
|
|
22
22
|
on(:invalid) do
|
@@ -22,7 +22,7 @@ module Decidim
|
|
22
22
|
def user
|
23
23
|
return unless params[:nickname]
|
24
24
|
|
25
|
-
@user ||= current_organization.users.find_by("
|
25
|
+
@user ||= current_organization.users.find_by("nickname = ?", params[:nickname].downcase)
|
26
26
|
end
|
27
27
|
|
28
28
|
def activities
|
@@ -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,
|
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? }
|
@@ -66,7 +69,7 @@ module Decidim
|
|
66
69
|
|
67
70
|
def unique_nickname
|
68
71
|
return true if Decidim::UserBaseEntity.where(
|
69
|
-
"decidim_organization_id = ? AND
|
72
|
+
"decidim_organization_id = ? AND nickname = ? ",
|
70
73
|
context.current_organization.id,
|
71
74
|
nickname.downcase
|
72
75
|
).where.not(id: context.current_user.id).empty?
|