decidim-core 0.29.2 → 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/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/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/search.rb +14 -0
- data/app/controllers/decidim/profiles_controller.rb +2 -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/decidim/orders_helper.rb +2 -1
- data/app/helpers/decidim/participatory_space_helpers.rb +1 -1
- 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/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/datepicker/datepicker_functions.js +3 -3
- data/app/packs/src/decidim/index.js +4 -2
- data/app/packs/src/decidim/map/provider/here.js +1 -1
- 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/application.scss +1 -0
- 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 +2 -0
- 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/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/config/locales/ar.yml +41 -28
- data/config/locales/bg.yml +10 -24
- data/config/locales/bs-BA.yml +2 -0
- data/config/locales/ca-IT.yml +2111 -0
- data/config/locales/ca.yml +57 -29
- data/config/locales/cs.yml +55 -32
- data/config/locales/de.yml +48 -24
- data/config/locales/el.yml +10 -15
- data/config/locales/en.yml +44 -16
- data/config/locales/eo.yml +2 -0
- data/config/locales/es-MX.yml +56 -28
- data/config/locales/es-PY.yml +61 -33
- data/config/locales/es.yml +60 -32
- data/config/locales/eu.yml +112 -87
- data/config/locales/fi-plain.yml +44 -28
- data/config/locales/fi.yml +46 -30
- data/config/locales/fr-CA.yml +58 -25
- data/config/locales/fr.yml +57 -24
- data/config/locales/ga-IE.yml +4 -4
- data/config/locales/gl.yml +25 -15
- data/config/locales/hu.yml +9 -23
- data/config/locales/id-ID.yml +24 -16
- data/config/locales/is-IS.yml +10 -1
- data/config/locales/it.yml +35 -27
- data/config/locales/ja.yml +55 -25
- data/config/locales/lb.yml +24 -22
- data/config/locales/lt.yml +5 -17
- data/config/locales/lv.yml +18 -15
- data/config/locales/nl.yml +23 -18
- data/config/locales/no.yml +18 -16
- data/config/locales/pl.yml +7 -21
- data/config/locales/pt-BR.yml +11 -24
- data/config/locales/pt.yml +18 -16
- data/config/locales/ro-RO.yml +243 -86
- data/config/locales/ru.yml +23 -8
- data/config/locales/sk.yml +29 -18
- data/config/locales/sl.yml +4 -0
- data/config/locales/sr-CS.yml +2 -0
- data/config/locales/sv.yml +22 -26
- data/config/locales/tr-TR.yml +24 -23
- data/config/locales/uk.yml +12 -2
- data/config/locales/zh-CN.yml +18 -15
- data/config/locales/zh-TW.yml +8 -16
- data/lib/decidim/asset_router/storage.rb +7 -2
- data/lib/decidim/attributes/time_with_zone.rb +5 -1
- data/lib/decidim/content_parsers/blob_parser.rb +10 -8
- data/lib/decidim/content_parsers/user_parser.rb +1 -1
- 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/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/reportable.rb +6 -2
- data/lib/decidim/translatable_attributes.rb +5 -1
- data/lib/tasks/upgrade/clean_hidden_resources.rake +33 -0
- data/lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake +23 -20
- metadata +15 -14
- 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
|
@@ -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,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
|
@@ -24,7 +24,7 @@ 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
28
|
end
|
29
29
|
|
30
30
|
def tooltip
|
@@ -116,7 +116,7 @@ module Decidim
|
|
116
116
|
def profile_holder
|
117
117
|
return if params[:nickname].blank?
|
118
118
|
|
119
|
-
@profile_holder ||= Decidim::UserBaseEntity.find_by("
|
119
|
+
@profile_holder ||= Decidim::UserBaseEntity.find_by("nickname = ? AND decidim_organization_id = ?", params[:nickname].downcase, current_organization.id)
|
120
120
|
end
|
121
121
|
end
|
122
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?
|
@@ -28,7 +28,7 @@ module Decidim
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def participatory_space_floating_help
|
31
|
-
return if help_section.blank?
|
31
|
+
return if help_section.blank? || strip_tags(translated_attribute(help_section).html_safe).blank?
|
32
32
|
|
33
33
|
floating_help(help_id) { translated_attribute(help_section).html_safe }
|
34
34
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class HideChildResourcesJob < ApplicationJob
|
5
|
+
queue_as :user_report
|
6
|
+
|
7
|
+
def perform(resource, user_id)
|
8
|
+
spam_user = (resource.organization.users.find_by(email: Decidim::Ai::SpamDetection.reporting_user_email) if Decidim.module_installed?(:ai))
|
9
|
+
spam_user = resource.organization.admins.find(user_id) if spam_user.nil?
|
10
|
+
|
11
|
+
tool = Decidim::ModerationTools.new(resource, spam_user)
|
12
|
+
|
13
|
+
unless Decidim::Report.exists?("decidim_moderation_id" => tool.moderation.id, "decidim_user_id" => spam_user.id)
|
14
|
+
tool.create_report!({
|
15
|
+
reason: "parent_hidden",
|
16
|
+
details: I18n.t("report_details", scope: "decidim.reports.parent_hidden")
|
17
|
+
})
|
18
|
+
end
|
19
|
+
|
20
|
+
tool.update_report_count!
|
21
|
+
tool.hide!
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -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")
|
@@ -156,15 +156,7 @@ module Decidim
|
|
156
156
|
|
157
157
|
def self.publicable_public_resource_types
|
158
158
|
@publicable_public_resource_types ||= public_resource_types
|
159
|
-
.select { |klass| klass.constantize.column_names.include?("published_at") }
|
160
|
-
end
|
161
|
-
|
162
|
-
def self.publicable_exceptions
|
163
|
-
@publicable_exceptions = %w(
|
164
|
-
Decidim::Blogs::Post
|
165
|
-
).select do |klass|
|
166
|
-
klass.safe_constantize.present?
|
167
|
-
end
|
159
|
+
.select { |klass| klass.constantize.column_names.include?("published_at") }
|
168
160
|
end
|
169
161
|
|
170
162
|
def self.ransackable_scopes(auth_object = nil)
|
@@ -5,7 +5,7 @@ module Decidim
|
|
5
5
|
class Report < ApplicationRecord
|
6
6
|
include Decidim::DownloadYourData
|
7
7
|
|
8
|
-
REASONS = %w(spam offensive does_not_belong hidden_during_block).freeze
|
8
|
+
REASONS = %w(spam offensive does_not_belong hidden_during_block parent_hidden).freeze
|
9
9
|
|
10
10
|
belongs_to :moderation, foreign_key: "decidim_moderation_id", class_name: "Decidim::Moderation"
|
11
11
|
belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User"
|
data/app/models/decidim/user.rb
CHANGED
@@ -13,8 +13,6 @@ module Decidim
|
|
13
13
|
include Decidim::UserReportable
|
14
14
|
include Decidim::Traceable
|
15
15
|
|
16
|
-
REGEXP_NICKNAME = /\A[\w-]+\z/
|
17
|
-
|
18
16
|
class Roles
|
19
17
|
def self.all
|
20
18
|
Decidim.config.user_roles
|
@@ -51,8 +49,6 @@ module Decidim
|
|
51
49
|
|
52
50
|
has_one_attached :download_your_data_file
|
53
51
|
|
54
|
-
scope :not_deleted, -> { where(deleted_at: nil) }
|
55
|
-
|
56
52
|
scope :managed, -> { where(managed: true) }
|
57
53
|
scope :not_managed, -> { where(managed: false) }
|
58
54
|
|
@@ -21,11 +21,13 @@ module Decidim
|
|
21
21
|
|
22
22
|
# Regex for name & nickname format validations
|
23
23
|
REGEXP_NAME = /\A(?!.*[<>?%&\^*#@()\[\]=+:;"{}\\|])/
|
24
|
+
REGEXP_NICKNAME = /\A[a-z0-9_-]+\z/
|
24
25
|
|
25
26
|
has_one_attached :avatar
|
26
27
|
validates_avatar :avatar, uploader: Decidim::AvatarUploader
|
27
28
|
|
28
29
|
validates :name, format: { with: REGEXP_NAME }
|
30
|
+
validates :nickname, format: { with: REGEXP_NICKNAME }, unless: -> { deleted? || managed? }
|
29
31
|
|
30
32
|
scope :confirmed, -> { where.not(confirmed_at: nil) }
|
31
33
|
scope :not_confirmed, -> { where(confirmed_at: nil) }
|
@@ -34,6 +36,8 @@ module Decidim
|
|
34
36
|
scope :not_blocked, -> { where(blocked: false) }
|
35
37
|
scope :available, -> { where(deleted_at: nil, blocked: false, managed: false) }
|
36
38
|
|
39
|
+
scope :not_deleted, -> { where(deleted_at: nil) }
|
40
|
+
|
37
41
|
# Public: Returns a collection with all the public entities this user is following.
|
38
42
|
#
|
39
43
|
# This cannot be done as with a `has_many :following, through: :following_follows`
|
@@ -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-
|
33
|
-
return `${
|
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 `${
|
37
|
+
return `${day}${formats.separator}${month}${formats.separator}${year}`;
|
38
38
|
};
|
39
39
|
|
40
40
|
export const formatInputTime = (time, format, input) => {
|
@@ -69,7 +69,8 @@ import handleNotificationActions from "src/decidim/notifications_actions"
|
|
69
69
|
import RemoteModal from "src/decidim/remote_modal"
|
70
70
|
import selectActiveIdentity from "src/decidim/identity_selector_dialog"
|
71
71
|
import createTooltip from "src/decidim/tooltips"
|
72
|
-
|
72
|
+
// Temporary disabling this feature because we have a poor performance. See https://github.com/decidim/decidim/issues/14431
|
73
|
+
// import fetchRemoteTooltip from "src/decidim/remote_tooltips"
|
73
74
|
import createToggle from "src/decidim/toggle"
|
74
75
|
import {
|
75
76
|
createAccordion,
|
@@ -196,7 +197,8 @@ const initializer = (element = document) => {
|
|
196
197
|
// Initialize data-toggles
|
197
198
|
element.querySelectorAll("[data-toggle]").forEach((elem) => createToggle(elem))
|
198
199
|
|
199
|
-
|
200
|
+
// Temporary disabling this feature because we have a poor performance. See https://github.com/decidim/decidim/issues/14431
|
201
|
+
// element.querySelectorAll("[data-remote-tooltip]").forEach((elem) => fetchRemoteTooltip(elem))
|
200
202
|
|
201
203
|
element.querySelectorAll(".new_report").forEach((elem) => changeReportFormBehavior(elem))
|
202
204
|
}
|