decidim-core 0.29.3 → 0.29.5
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/show.erb +6 -6
- data/app/cells/decidim/address/show.erb +3 -3
- data/app/cells/decidim/author/show.erb +2 -4
- data/app/cells/decidim/content_blocks/participatory_space_extra_data/extra_data.erb +2 -2
- data/app/cells/decidim/content_blocks/participatory_space_main_data/title.erb +11 -2
- data/app/cells/decidim/footer_topics/show.erb +2 -2
- data/app/cells/decidim/group_admins/show.erb +3 -1
- data/app/cells/decidim/group_members/show.erb +6 -2
- data/app/cells/decidim/images_panel/show.erb +5 -2
- data/app/cells/decidim/participatory_space_dropdown_metadata/metadata.erb +4 -4
- data/app/cells/decidim/report_button/flag_modal.erb +11 -9
- data/app/cells/decidim/report_user_button/flag_modal.erb +11 -10
- data/app/cells/decidim/upload_modal/files.erb +4 -4
- data/app/cells/decidim/upload_modal_cell.rb +5 -3
- data/app/commands/decidim/amendable/accept.rb +2 -1
- data/app/commands/decidim/create_report.rb +5 -1
- data/app/commands/decidim/invite_user.rb +1 -1
- data/app/controllers/concerns/decidim/headers/browser_feature_permissions.rb +50 -0
- data/app/controllers/concerns/decidim/participatory_space_context.rb +4 -1
- data/app/controllers/decidim/amendments_controller.rb +3 -3
- data/app/controllers/decidim/application_controller.rb +1 -0
- data/app/controllers/decidim/reports_controller.rb +6 -1
- data/app/forms/decidim/omniauth_registration_form.rb +1 -1
- data/app/forms/decidim/registration_form.rb +1 -1
- data/app/helpers/decidim/amendments_helper.rb +2 -1
- data/app/helpers/decidim/filters_helper.rb +25 -0
- data/app/helpers/decidim/layout_helper.rb +6 -0
- data/app/helpers/decidim/menu_helper.rb +2 -2
- data/app/helpers/decidim/paginate_helper.rb +1 -1
- data/app/helpers/decidim/tooltip_helper.rb +4 -1
- data/app/mailers/decidim/notifications_digest_mailer.rb +7 -1
- data/app/mailers/decidim/reported_mailer.rb +17 -2
- data/app/packs/images/decidim/default-avatar.svg +1 -1
- data/app/packs/src/decidim/callout.js +13 -8
- data/app/packs/src/decidim/confirm.js +79 -59
- data/app/packs/src/decidim/datepicker/generate_datepicker.js +2 -0
- data/app/packs/src/decidim/datepicker/generate_timepicker.js +2 -0
- data/app/packs/src/decidim/direct_uploads/upload_field.js +3 -4
- data/app/packs/src/decidim/direct_uploads/upload_modal.js +8 -9
- data/app/packs/src/decidim/dropdown_menu.js +18 -0
- data/app/packs/src/decidim/editor/common/suggestion.js +11 -1
- data/app/packs/src/decidim/form_remote.js +1 -1
- data/app/packs/src/decidim/impersonation.js +1 -1
- data/app/packs/src/decidim/index.js +5 -1
- data/app/packs/src/decidim/input_character_counter.js +1 -1
- data/app/packs/src/decidim/session_timeouter.js +1 -1
- data/app/packs/src/decidim/utilities/dom.js +148 -0
- data/app/packs/stylesheets/decidim/_activity.scss +4 -4
- data/app/packs/stylesheets/decidim/_cards.scss +4 -0
- data/app/packs/stylesheets/decidim/_filters.scss +1 -1
- data/app/packs/stylesheets/decidim/_header.scss +64 -37
- data/app/packs/stylesheets/decidim/_layout.scss +2 -2
- data/app/packs/stylesheets/decidim/_modal.scss +1 -5
- data/app/packs/stylesheets/decidim/_modal_update.scss +5 -1
- data/app/permissions/decidim/default_permissions.rb +2 -0
- data/app/permissions/decidim/permissions.rb +13 -1
- data/app/presenters/decidim/notification_to_mailer_presenter.rb +7 -3
- data/app/queries/decidim/last_activity.rb +25 -0
- data/app/views/decidim/errors/internal_server_error.html.erb +1 -1
- data/app/views/decidim/errors/not_found.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_reply_form.html.erb +1 -2
- data/app/views/decidim/messaging/conversations/_start.html.erb +1 -1
- data/app/views/decidim/newsletters/unsubscribe.html.erb +16 -4
- data/app/views/decidim/reported_mailer/hidden_manually.html.erb +25 -0
- data/app/views/decidim/searches/_filters.html.erb +48 -13
- data/app/views/decidim/shared/_component_announcement.html.erb +1 -1
- data/app/views/decidim/shared/_confirm_modal.html.erb +3 -5
- data/app/views/decidim/shared/_filters.html.erb +6 -4
- data/app/views/decidim/shared/_results_per_page.html.erb +1 -1
- data/app/views/kaminari/decidim/_page.html.erb +1 -1
- data/app/views/kaminari/decidim/_paginator.html.erb +1 -1
- data/app/views/layouts/decidim/_js_configuration.html.erb +1 -0
- data/app/views/layouts/decidim/_logo.html.erb +2 -2
- data/app/views/layouts/decidim/footer/_main.html.erb +1 -1
- data/app/views/layouts/decidim/footer/_main_intro.html.erb +1 -1
- data/app/views/layouts/decidim/footer/_mini.html.erb +2 -2
- data/app/views/layouts/decidim/header/_main.html.erb +2 -2
- data/app/views/layouts/decidim/header/_main_links_desktop.html.erb +6 -0
- data/app/views/layouts/decidim/header/_main_links_dropdown.html.erb +2 -0
- data/app/views/layouts/decidim/header/_main_links_mobile_account.html.erb +1 -1
- data/app/views/layouts/decidim/header/_menu_breadcrumb_main_dropdown_desktop.html.erb +5 -11
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +5 -5
- data/app/views/layouts/decidim/header/_mobile_language_choose.html.erb +1 -1
- data/config/locales/ar.yml +0 -9
- data/config/locales/bg-BG.yml +2 -2
- data/config/locales/bg.yml +0 -11
- data/config/locales/ca-IT.yml +41 -6
- data/config/locales/ca.yml +41 -6
- data/config/locales/cs.yml +33 -10
- data/config/locales/de.yml +63 -25
- data/config/locales/el.yml +0 -10
- data/config/locales/en.yml +41 -6
- data/config/locales/es-MX.yml +42 -7
- data/config/locales/es-PY.yml +42 -7
- data/config/locales/es.yml +41 -6
- data/config/locales/eu.yml +79 -43
- data/config/locales/fi-plain.yml +55 -8
- data/config/locales/fi.yml +56 -9
- data/config/locales/fr-CA.yml +43 -9
- data/config/locales/fr-LU.yml +3 -3
- data/config/locales/fr.yml +43 -9
- data/config/locales/gl.yml +0 -8
- data/config/locales/hu.yml +0 -11
- data/config/locales/id-ID.yml +0 -8
- data/config/locales/is-IS.yml +0 -6
- data/config/locales/it.yml +124 -8
- data/config/locales/ja.yml +45 -11
- data/config/locales/lb-LU.yml +2 -2
- data/config/locales/lb.yml +0 -8
- data/config/locales/lt.yml +0 -11
- data/config/locales/lv.yml +0 -8
- data/config/locales/nl.yml +0 -8
- data/config/locales/no.yml +0 -8
- data/config/locales/pl.yml +0 -11
- data/config/locales/pt-BR.yml +1 -10
- data/config/locales/pt.yml +0 -8
- data/config/locales/ro-RO.yml +0 -14
- data/config/locales/ru.yml +0 -8
- data/config/locales/sk-SK.yml +3 -3
- data/config/locales/sk.yml +2 -8
- data/config/locales/sv.yml +56 -16
- data/config/locales/tr-TR.yml +1 -8
- data/config/locales/uk.yml +0 -7
- data/config/locales/zh-CN.yml +0 -8
- data/config/locales/zh-TW.yml +0 -11
- data/db/migrate/20171212103803_create_unique_nicknames.rb +1 -1
- data/db/migrate/20180221101934_fix_nickname_index.rb +1 -1
- data/db/migrate/20180706104107_add_nickname_to_managed_users.rb +1 -1
- data/db/migrate/20181001124950_move_users_groups_to_users_table.rb +1 -1
- data/db/migrate/20190412131728_fix_user_names.rb +1 -1
- data/lib/decidim/assets/tailwind/tailwind.config.js.erb +2 -1
- data/lib/decidim/core/test/factories.rb +2 -2
- data/lib/decidim/core/test/shared_examples/announcements_examples.rb +4 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/form_builder.rb +14 -0
- data/lib/decidim/nicknamizable.rb +6 -9
- data/lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake +1 -1
- metadata +11 -7
- /data/app/views/decidim/reported_mailer/{hide.html.erb → hidden_automatically.html.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a294fcf54a5fa31a1d5e44af9a717e30ab8eab2df35ae131b9873e0d600dc630
|
4
|
+
data.tar.gz: 41703d211fa0d4d30c760cf00629bfebda559481e039298ac6a30679a46fe77c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28e137934317b858031cda83491fb067b5ee54349fb50f037c1c0e4aa6f223afeb13899e28df90492ee53b5097a09a3d7c1add57e4d0aa0b080997a706646c89
|
7
|
+
data.tar.gz: 2e153e8e591bd91f1c6fb0ec14b5a7de5ce126191aa89ba698bf64a9a4389d4fb5e8bceb84cc5d43dc77f669b2549971c7d4e2cdfaed4cca6b8dce17172a3829
|
@@ -1,19 +1,19 @@
|
|
1
1
|
<div class="activity" data-activity>
|
2
|
-
<
|
2
|
+
<p class="activity__time">
|
3
3
|
<%= created_at %>
|
4
|
-
</
|
4
|
+
</p>
|
5
5
|
<div class="activity__content">
|
6
|
-
<
|
6
|
+
<div>
|
7
7
|
<% if title.present? %>
|
8
|
-
<
|
8
|
+
<p>
|
9
9
|
<%= title_icon %>
|
10
10
|
<%= title %>
|
11
|
-
</
|
11
|
+
</p>
|
12
12
|
<% end %>
|
13
13
|
<a href="<%= resource_link_path %>">
|
14
14
|
<%= html_truncate decidim_sanitize(resource_link_text, strip_tags: true), length: 80 %>
|
15
15
|
</a>
|
16
|
-
</
|
16
|
+
</div>
|
17
17
|
<% unless hide_participatory_space? %>
|
18
18
|
<span>
|
19
19
|
<%= participatory_space_link %>
|
@@ -4,13 +4,13 @@
|
|
4
4
|
<%= icon "map-pin-line" %>
|
5
5
|
<div class="address">
|
6
6
|
<% if has_location? %>
|
7
|
-
<
|
7
|
+
<p class="address__location"><%= location %></p>
|
8
8
|
<% end %>
|
9
9
|
|
10
|
-
<
|
10
|
+
<p class="address__address"><%= address %></p>
|
11
11
|
|
12
12
|
<% if has_location_hints? %>
|
13
|
-
<
|
13
|
+
<p class="address__hints"><%= location_hints %></p>
|
14
14
|
<% end %>
|
15
15
|
</div>
|
16
16
|
</div>
|
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<%= content_tag(:span, class: :author, data: ) do %>
|
4
|
-
<%= content_tag :span, class: "author__container#{" is-compact" if layout == :compact}", data: tooltip do %>
|
1
|
+
<%= content_tag(:p, class: :author, data: ) do %>
|
2
|
+
<%= content_tag :span, class: "author__container#{" is-compact" if layout == :compact}" do %>
|
5
3
|
<% if layout == :compact %>
|
6
4
|
<%= render :avatar %>
|
7
5
|
|
@@ -2,10 +2,10 @@
|
|
2
2
|
<div class="participatory-space__metadata-item">
|
3
3
|
<div class="participatory-space__metadata-item-title">
|
4
4
|
<%= icon item[:icon] %>
|
5
|
-
<
|
5
|
+
<h2><%= item[:title] %></h2>
|
6
6
|
</div>
|
7
7
|
<% if item[:text].present? %>
|
8
|
-
<%= content_tag :
|
8
|
+
<%= content_tag :p, item[:text] %>
|
9
9
|
<% elsif item[:partial].present? %>
|
10
10
|
<%= render item[:partial] %>
|
11
11
|
<% end %>
|
@@ -11,11 +11,11 @@
|
|
11
11
|
<div class="content-block__description editor-content" <%= "data-component='accordion'" if should_truncate %>>
|
12
12
|
<% if should_truncate %>
|
13
13
|
<% seed = SecureRandom.hex(4) %>
|
14
|
-
<div id="panel-view-more-<%= seed %>" aria-hidden="true">
|
14
|
+
<div id="panel-view-more-<%= seed %>" aria-hidden="true" inert>
|
15
15
|
<%= description_text %>
|
16
16
|
</div>
|
17
17
|
|
18
|
-
<button class="button button__sm button__text-secondary mt-2" data-controls="panel-view-more-<%= seed %>" aria-expanded="false">
|
18
|
+
<button class="button button__sm button__text-secondary mt-2" data-controls="panel-view-more-<%= seed %>" aria-expanded="false" onclick="document.querySelector('div[id^=panel-view-more]').toggleAttribute('inert')">
|
19
19
|
<span>
|
20
20
|
<%= t("view_more", scope: "layouts.decidim.announcements") %>
|
21
21
|
</span>
|
@@ -30,3 +30,12 @@
|
|
30
30
|
<% end %>
|
31
31
|
</div>
|
32
32
|
<% end %>
|
33
|
+
<script>
|
34
|
+
const button = document.querySelector('button[data-controls^="panel-view-more"]')
|
35
|
+
button.addEventListener('keydown', function(e){
|
36
|
+
// press space or enter
|
37
|
+
if (e.keyCode === 32 || e.keyCode === 13){
|
38
|
+
document.querySelector('div[id^=panel-view-more]').toggleAttribute('inert')
|
39
|
+
}
|
40
|
+
})
|
41
|
+
</script>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<nav role="navigation" aria-label="
|
2
|
-
<h2 class="h4 mb-4"
|
1
|
+
<nav role="navigation" aria-label="<%= t("layouts.decidim.footer.help") %>">
|
2
|
+
<h2 class="h4 mb-4"><%= t("layouts.decidim.footer.help") %></h2>
|
3
3
|
<ul class="space-y-4 break-inside-avoid">
|
4
4
|
<% topics.each do |topic| %>
|
5
5
|
<%= topic_item(topic, class: "font-semibold underline") %>
|
@@ -21,7 +21,9 @@
|
|
21
21
|
<%= link_to(
|
22
22
|
decidim.demote_group_manage_user_path(model.nickname, membership),
|
23
23
|
method: :post,
|
24
|
-
data: { confirm: t("decidim.group_admins.actions.
|
24
|
+
data: { confirm: t("decidim.group_admins.actions.confirm_remove_from_admin"),
|
25
|
+
confirm_title: t("decidim.group_admins.actions.confirm_modal.title_remove"),
|
26
|
+
confirm_button: t("decidim.group_admins.actions.confirm_modal.ok_remove") },
|
25
27
|
class: "button button__sm button__transparent-secondary"
|
26
28
|
) do %>
|
27
29
|
<span><%= t("decidim.group_admins.actions.demote_admin") %></span>
|
@@ -24,14 +24,18 @@
|
|
24
24
|
t("decidim.group_members.actions.promote_to_admin"),
|
25
25
|
decidim.promote_group_manage_user_path(model.nickname, membership),
|
26
26
|
method: :post,
|
27
|
-
data: { confirm: t("decidim.group_members.actions.
|
27
|
+
data: { confirm: t("decidim.group_members.actions.confirm_promote_to_admin"),
|
28
|
+
confirm_title: t("decidim.group_admins.actions.confirm_modal.title_add"),
|
29
|
+
confirm_button: t("decidim.group_admins.actions.confirm_modal.ok_add") },
|
28
30
|
class: "button button__sm button__transparent-secondary"
|
29
31
|
) %>
|
30
32
|
|
31
33
|
<%= link_to(
|
32
34
|
decidim.group_manage_user_path(model.nickname, membership),
|
33
35
|
method: :delete,
|
34
|
-
data: { confirm: t("decidim.group_members.actions.
|
36
|
+
data: { confirm: t("decidim.group_members.actions.confirm_remove_from_group"),
|
37
|
+
confirm_title: t("decidim.group_members.actions.confirm_modal.title_remove"),
|
38
|
+
confirm_button: t("decidim.group_members.actions.confirm_modal.ok_remove") },
|
35
39
|
class: "button button__sm button__transparent-secondary"
|
36
40
|
) do %>
|
37
41
|
<span><%= t("decidim.group_members.actions.remove_from_group") %></span>
|
@@ -1,7 +1,10 @@
|
|
1
1
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-6">
|
2
|
-
<% photos.each_with_index do |photo
|
2
|
+
<% photos.each_with_index do |photo| %>
|
3
3
|
<%= link_to photo.big_url, target: "_blank", rel: "noopener", class: "overflow-hidden rounded aspect-video" do %>
|
4
|
-
<%= image_tag photo.thumbnail_url,
|
4
|
+
<%= image_tag photo.thumbnail_url,
|
5
|
+
class: "w-full h-full object-cover",
|
6
|
+
role: "presentation",
|
7
|
+
"data-filename": strip_tags(translated_attribute(photo.title)) %>
|
5
8
|
<% end %>
|
6
9
|
<% end %>
|
7
10
|
</div>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<h4 class="menu-bar__secondary-dropdown__title"><%= title %></h4>
|
2
|
-
|
3
|
-
|
2
|
+
<% if hashtag.present? %>
|
3
|
+
<div class="menu-bar__secondary-dropdown__metadata">
|
4
4
|
<span>
|
5
5
|
<%= icon "twitter-x-line", class: "text-gray fill-current" %>
|
6
6
|
<%= link_to "##{hashtag}", twitter_hashtag_url(hashtag), target: "_blank", class: "text-secondary underline" %>
|
7
7
|
</span>
|
8
|
-
|
9
|
-
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -6,16 +6,18 @@
|
|
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>
|
9
|
-
<
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
<fieldset class="mt-6">
|
10
|
+
<legend class="flag-modal__form-reason"><%= t("decidim.shared.flag_modal.reason") %>:</legend>
|
11
|
+
<%= f.collection_radio_buttons :reason, [
|
12
|
+
[:spam, t("decidim.shared.flag_modal.spam")],
|
13
|
+
[:offensive, t("decidim.shared.flag_modal.offensive")],
|
14
|
+
[:does_not_belong, t("decidim.shared.flag_modal.does_not_belong", organization_name: current_organization_name)]
|
15
|
+
], :first, :last do |builder|
|
16
|
+
builder.label(for: "#{builder.value.to_s}-#{modal_id}", class: "form__wrapper-checkbox-label") { builder.radio_button(id: "#{builder.value.to_s}-#{modal_id}") + builder.text }
|
17
|
+
end %>
|
18
|
+
</fieldset>
|
17
19
|
|
18
|
-
<%= f.text_area :details, rows: 4, label_options: { class: "flag-modal__form-textarea-label", for:
|
20
|
+
<%= f.text_area :details, rows: 4, label_options: { class: "flag-modal__form-textarea-label", for: "additional-comments-#{modal_id}" }, id: "additional-comments-#{modal_id}" %>
|
19
21
|
|
20
22
|
<% if frontend_administrable? %>
|
21
23
|
<%= f.check_box :hide,
|
@@ -6,16 +6,17 @@
|
|
6
6
|
<div>
|
7
7
|
<div class="form__wrapper flag-modal__form">
|
8
8
|
<p class="flag-modal__form-description"><%= t("decidim.shared.flag_user_modal.description") %></p>
|
9
|
-
<
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
<fieldset class="mt-6">
|
10
|
+
<legend class="flag-modal__form-reason"><%= t("decidim.shared.flag_modal.reason") %>:</legend>
|
11
|
+
<%= f.collection_radio_buttons :reason, [
|
12
|
+
[:spam, t("decidim.shared.flag_user_modal.spam")],
|
13
|
+
[:offensive, t("decidim.shared.flag_user_modal.offensive")],
|
14
|
+
[:does_not_belong, t("decidim.shared.flag_user_modal.does_not_belong", organization_name: current_organization_name)]
|
15
|
+
], :first, :last do |builder|
|
16
|
+
builder.label(for: "#{builder.value.to_s}-#{modal_id}", class: "form__wrapper-checkbox-label") { builder.radio_button(id: "#{builder.value.to_s}-#{modal_id}") + builder.text }
|
17
|
+
end %>
|
18
|
+
</fieldset>
|
19
|
+
<%= f.text_area :details, rows: 4, label_options: { class: "flag-modal__form-textarea-label", for: "additional-comments-#{modal_id}" }, id: "additional-comments-#{modal_id}" %>
|
19
20
|
|
20
21
|
<% if frontend_administrable? %>
|
21
22
|
<%= f.check_box :block,
|
@@ -25,19 +25,19 @@
|
|
25
25
|
|
26
26
|
<div class="attachment-details" data-attachment-id="<%= attachment.id %>" data-title="<%= title_for(attachment) %>" data-filename="<%= file_name_for(attachment) %>" data-state="uploaded">
|
27
27
|
<% if file_attachment_path(attachment) && blob(attachment).image? %>
|
28
|
-
<div><%= image_tag(file_attachment_path(attachment), alt:
|
28
|
+
<div><%= image_tag(file_attachment_path(attachment), alt: "") %></div>
|
29
29
|
<% elsif uploader_default_image_path(attribute).present? %>
|
30
30
|
<div><%= image_tag uploader_default_image_path(attribute) %></div>
|
31
31
|
<% end %>
|
32
32
|
|
33
33
|
<% if has_title? %>
|
34
|
-
<span><%= title_for(attachment)
|
34
|
+
<span><%= title_for(attachment) %></span>
|
35
35
|
<%= form.hidden_field attribute, multiple: true, value: attachment.id, id: attachment.id %>
|
36
36
|
<% else %>
|
37
37
|
<% if blob(attachment).image? %>
|
38
|
-
<span><%=
|
38
|
+
<span><%= title_for(attachment) %></span>
|
39
39
|
<% else %>
|
40
|
-
<%= link_to
|
40
|
+
<%= link_to title_for(attachment), file_attachment_path(attachment), class: "w-full break-all mb-2" %>
|
41
41
|
<% end %>
|
42
42
|
<% end %>
|
43
43
|
</div>
|
@@ -132,9 +132,11 @@ module Decidim
|
|
132
132
|
end
|
133
133
|
|
134
134
|
def title_for(attachment)
|
135
|
-
|
136
|
-
|
137
|
-
|
135
|
+
if has_title?
|
136
|
+
decidim_html_escape(decidim_sanitize(translated_attribute(attachment.title)))
|
137
|
+
else
|
138
|
+
decidim_html_escape(decidim_sanitize(determine_filename(attachment)))
|
139
|
+
end
|
138
140
|
end
|
139
141
|
|
140
142
|
def truncated_file_name_for(attachment, max_length = 31)
|
@@ -62,7 +62,8 @@ module Decidim
|
|
62
62
|
@amendable.save!
|
63
63
|
@amendable
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
|
+
@amendable.add_coauthor(@amender, user_group: @user_group) if @amendable.is_a?(Decidim::Coauthorable)
|
66
67
|
end
|
67
68
|
|
68
69
|
def notify_emendation_state_change!
|
@@ -76,7 +76,11 @@ module Decidim
|
|
76
76
|
participatory_space_moderators.each do |moderator|
|
77
77
|
next unless moderator.email_on_moderations
|
78
78
|
|
79
|
-
|
79
|
+
if hidden_by_admin?
|
80
|
+
ReportedMailer.hidden_manually(moderator, @report, current_user).deliver_later
|
81
|
+
else
|
82
|
+
ReportedMailer.hidden_automatically(moderator, @report).deliver_later
|
83
|
+
end
|
80
84
|
end
|
81
85
|
end
|
82
86
|
|
@@ -41,7 +41,7 @@ module Decidim
|
|
41
41
|
@user = Decidim::User.new(
|
42
42
|
name: form.name,
|
43
43
|
email: form.email.downcase,
|
44
|
-
nickname: UserBaseEntity.nicknamize(form.name,
|
44
|
+
nickname: UserBaseEntity.nicknamize(form.name, form.organization.id),
|
45
45
|
organization: form.organization,
|
46
46
|
admin: form.role == "admin",
|
47
47
|
roles: form.role == "admin" ? [] : [form.role].compact
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Headers
|
7
|
+
# This module controls the "Permissions-Policy" header to define the
|
8
|
+
# specific sets of browser features that the website is able to use.
|
9
|
+
module BrowserFeaturePermissions
|
10
|
+
extend ActiveSupport::Concern
|
11
|
+
|
12
|
+
included do
|
13
|
+
after_action :define_permissions_policy
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def define_permissions_policy
|
19
|
+
return if response.media_type != "text/html"
|
20
|
+
return if response.headers["Permissions-Policy"].present?
|
21
|
+
|
22
|
+
# Allow the "unload" and "onbeforeunload" events to be used at the
|
23
|
+
# current domain to prevent the user unintentionally changing the page
|
24
|
+
# when they have something important to do on the page, such as an
|
25
|
+
# unsaved form.
|
26
|
+
#
|
27
|
+
# This header is required because Chrome is phasing this event out due
|
28
|
+
# to some performance issues with the back/forward cache feature of the
|
29
|
+
# browser. However, currently there are no alternative events that would
|
30
|
+
# allow preventing accidental page reloads, tab closing or window
|
31
|
+
# closing.
|
32
|
+
#
|
33
|
+
# For further information, see:
|
34
|
+
# https://developer.chrome.com/docs/web-platform/deprecating-unload
|
35
|
+
# https://github.com/fergald/docs/blob/master/explainers/permissions-policy-unload.md
|
36
|
+
#
|
37
|
+
# Note that even Google suggests using the "beforeunload" for this
|
38
|
+
# particular use case:
|
39
|
+
# https://developer.chrome.com/docs/web-platform/page-lifecycle-api#events
|
40
|
+
#
|
41
|
+
# beforeunload
|
42
|
+
# Important: the beforeunload event should only be used to alert the
|
43
|
+
# user of unsaved changes. Once those changes are saved, the event
|
44
|
+
# should be removed. It should never be added unconditionally to the
|
45
|
+
# page, as doing so can hurt performance in some cases.
|
46
|
+
response.headers["Permissions-Policy"] = "unload=(self)"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -9,6 +9,7 @@ module Decidim
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
include Decidim::NeedsOrganization
|
12
|
+
include Decidim::UserRoleChecker
|
12
13
|
|
13
14
|
helper ParticipatorySpaceHelpers, IconHelper, ContextualHelpHelper
|
14
15
|
helper_method :current_participatory_space
|
@@ -81,8 +82,10 @@ module Decidim
|
|
81
82
|
return true unless current_participatory_space.try(:private_space?) &&
|
82
83
|
!current_participatory_space.try(:is_transparent?)
|
83
84
|
return false unless current_user
|
85
|
+
return true if current_user.admin?
|
86
|
+
return true if user_has_any_role?(current_user, current_participatory_space, broad_check: true)
|
84
87
|
|
85
|
-
|
88
|
+
current_participatory_space.users.include?(current_user)
|
86
89
|
end
|
87
90
|
|
88
91
|
def help_section
|
@@ -107,7 +107,7 @@ module Decidim
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def reject
|
110
|
-
enforce_permission_to :reject, :amendment, current_component: amendable.component
|
110
|
+
enforce_permission_to :reject, :amendment, amendable:, current_component: amendable.component
|
111
111
|
|
112
112
|
@form = form(Decidim::Amendable::RejectForm).from_model(amendment)
|
113
113
|
|
@@ -143,13 +143,13 @@ module Decidim
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def review
|
146
|
-
enforce_permission_to :accept, :amendment, current_component: amendable.component
|
146
|
+
enforce_permission_to :accept, :amendment, amendable:, current_component: amendable.component
|
147
147
|
|
148
148
|
@form = form(Decidim::Amendable::ReviewForm).from_params(params)
|
149
149
|
end
|
150
150
|
|
151
151
|
def accept
|
152
|
-
enforce_permission_to :accept, :amendment, current_component: amendable.component
|
152
|
+
enforce_permission_to :accept, :amendment, amendable:, current_component: amendable.component
|
153
153
|
|
154
154
|
@form = form(Decidim::Amendable::ReviewForm).from_params(params)
|
155
155
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
# Exposes the report resource so users can report a reportable.
|
5
|
+
# Unless the reportable is marked as hideable, the resource notice will change accordingly.
|
5
6
|
class ReportsController < Decidim::ApplicationController
|
6
7
|
include FormFactory
|
7
8
|
include NeedsPermission
|
@@ -15,7 +16,11 @@ module Decidim
|
|
15
16
|
|
16
17
|
CreateReport.call(@form, reportable) do
|
17
18
|
on(:ok) do
|
18
|
-
flash[:notice] =
|
19
|
+
flash[:notice] = if hideable?
|
20
|
+
I18n.t("decidim.reports.hide.success")
|
21
|
+
else
|
22
|
+
I18n.t("decidim.reports.create.success")
|
23
|
+
end
|
19
24
|
redirect_to reportable.reload.reported_content_url
|
20
25
|
end
|
21
26
|
|
@@ -70,8 +70,9 @@ module Decidim
|
|
70
70
|
# Checks if the user can accept and reject the emendation
|
71
71
|
def allowed_to_accept_and_reject?(emendation)
|
72
72
|
return unless emendation.amendment.evaluating?
|
73
|
+
return current_user.admin? if emendation.amendable.respond_to?(:official?) && emendation.amendable.official?
|
73
74
|
|
74
|
-
emendation.amendable.created_by?(current_user)
|
75
|
+
emendation.amendable.created_by?(current_user)
|
75
76
|
end
|
76
77
|
|
77
78
|
# Checks if the user can promote the emendation
|
@@ -32,6 +32,31 @@ module Decidim
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
def filter_search_label(label, id)
|
36
|
+
I18n.t("decidim.searches.filters.resource", label:, collection: filter_for_resource(id))
|
37
|
+
end
|
38
|
+
|
39
|
+
def filter_for_resource(skip_to_id)
|
40
|
+
case skip_to_id
|
41
|
+
when "proposals"
|
42
|
+
I18n.t("decidim/proposals/proposal.other", scope: "activerecord.models")
|
43
|
+
when "meetings"
|
44
|
+
I18n.t("decidim/meetings/meeting.other", scope: "activerecord.models")
|
45
|
+
when "debates"
|
46
|
+
I18n.t("decidim/debates/debate.other", scope: "activerecord.models")
|
47
|
+
when "sortitions"
|
48
|
+
I18n.t("decidim/sortitions/sortition.other", scope: "activerecord.models")
|
49
|
+
when "surveys"
|
50
|
+
I18n.t("decidim/surveys/survey.other", scope: "activerecord.models")
|
51
|
+
when "projects"
|
52
|
+
I18n.t("decidim/budgets/project.other", scope: "activerecord.models")
|
53
|
+
when "initiatives"
|
54
|
+
I18n.t("decidim/initiative.other", scope: "activerecord.models")
|
55
|
+
else
|
56
|
+
""
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
35
60
|
private
|
36
61
|
|
37
62
|
# Creates a unique namespace for a filter form to prevent duplicate IDs in
|
@@ -60,6 +60,12 @@ module Decidim
|
|
60
60
|
html_properties = options.with_indifferent_access.transform_keys(&:dasherize).slice("width", "height", "aria-label", "role", "aria-hidden", "class", "style")
|
61
61
|
html_properties = default_html_properties.merge(html_properties)
|
62
62
|
|
63
|
+
if name == "wechat-line"
|
64
|
+
html_properties = html_properties.merge({ "aria-label" => I18n.t("decidim.author.comments.other") }).except("aria-hidden")
|
65
|
+
elsif name == "heart-line"
|
66
|
+
html_properties = html_properties.merge({ "aria-label" => I18n.t("decidim.author.endorsements.other") }).except("aria-hidden")
|
67
|
+
end
|
68
|
+
|
63
69
|
href = Decidim.cors_enabled ? "" : asset_pack_path("media/images/remixicon.symbol.svg")
|
64
70
|
|
65
71
|
content_tag :svg, html_properties do
|
@@ -39,7 +39,7 @@ module Decidim
|
|
39
39
|
@breadcrumb_root_menu ||= ::Decidim::BreadcrumbRootMenuPresenter.new(
|
40
40
|
:menu,
|
41
41
|
self,
|
42
|
-
container_options: { class: "menu-
|
42
|
+
container_options: { class: "menu-bar__dropdown-menu" }
|
43
43
|
)
|
44
44
|
end
|
45
45
|
|
@@ -47,7 +47,7 @@ module Decidim
|
|
47
47
|
@mobile_breadcrumb_root_menu ||= ::Decidim::BreadcrumbRootMenuPresenter.new(
|
48
48
|
:mobile_menu,
|
49
49
|
self,
|
50
|
-
container_options: { class: "menu-bar__main-
|
50
|
+
container_options: { class: "menu-bar__main-dropdown__top-menu" }
|
51
51
|
)
|
52
52
|
end
|
53
53
|
|
@@ -13,7 +13,7 @@ module Decidim
|
|
13
13
|
|
14
14
|
per_page = (params[:per_page] || paginate_params[:per_page] || Decidim::Paginable::OPTIONS.first).to_i
|
15
15
|
|
16
|
-
content_tag :div, class: "flex flex-col-reverse md:flex-row items-center justify-between gap-1 py-8 md:py-16", data: { pagination: "" } do
|
16
|
+
content_tag :div, class: "flex flex-col-reverse md:flex-row items-center justify-between gap-1 py-8 md:py-16 md:flex-wrap", data: { pagination: "" } do
|
17
17
|
template = ""
|
18
18
|
template += render(partial: "decidim/shared/results_per_page", locals: { per_page: }, formats: [:html]) if collection.total_pages.positive?
|
19
19
|
template += paginate collection, window: 2, outer_window: 1, theme: "decidim", params: paginate_params
|
@@ -5,7 +5,10 @@ module Decidim
|
|
5
5
|
# on the layout.
|
6
6
|
module TooltipHelper
|
7
7
|
def with_tooltip(title, opts = {}, &)
|
8
|
-
content_tag(:
|
8
|
+
content_tag(:p,
|
9
|
+
title:,
|
10
|
+
class: "inline-block",
|
11
|
+
data: { tooltip: content_tag(:p, title, id: opts[:id], class: opts[:class] || "bottom", role: "tooltip", "aria-hidden": "true") }) do
|
9
12
|
capture(&).html_safe
|
10
13
|
end
|
11
14
|
end
|
@@ -14,7 +14,13 @@ module Decidim
|
|
14
14
|
@organization = user.organization
|
15
15
|
@notifications_digest = Decidim::NotificationsDigestPresenter.new(user)
|
16
16
|
@display_see_more_message = notifications.size > SIZE_LIMIT
|
17
|
-
|
17
|
+
# Note that this could be improved by adding a "type" column to the notifications table
|
18
|
+
# This fix can generate lists of notifications that are below the SIZE_LIMIT
|
19
|
+
@notifications = notifications[0...SIZE_LIMIT].filter_map do |notification|
|
20
|
+
next unless notification.event_class_instance.respond_to?(:email_intro)
|
21
|
+
|
22
|
+
Decidim::NotificationToMailerPresenter.new(notification)
|
23
|
+
end
|
18
24
|
|
19
25
|
mail(to: user.email, subject: @notifications_digest.subject)
|
20
26
|
end
|
@@ -21,14 +21,29 @@ module Decidim
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
# This is used when a user with special rights (like an administrator, a space administrator or a moderator) hides a resource
|
25
|
+
def hidden_manually(user, report, current_user)
|
25
26
|
with_user(user) do
|
26
27
|
@report = report
|
27
28
|
@participatory_space = @report.moderation.participatory_space
|
28
29
|
@reportable = @report.moderation.reportable
|
29
30
|
@organization = user.organization
|
30
31
|
@user = user
|
31
|
-
|
32
|
+
@moderator = current_user
|
33
|
+
subject = I18n.t("hidden_manually.subject", scope: "decidim.reported_mailer", moderator: @moderator.name)
|
34
|
+
mail(to: user.email, subject:)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# This is meant to be used when a resource is hidden by an algorithm, such as the `decidim-ai` module, or the `Decidim.max_reports_before_hiding` feature.
|
39
|
+
def hidden_automatically(user, report)
|
40
|
+
with_user(user) do
|
41
|
+
@report = report
|
42
|
+
@participatory_space = @report.moderation.participatory_space
|
43
|
+
@reportable = @report.moderation.reportable
|
44
|
+
@organization = user.organization
|
45
|
+
@user = user
|
46
|
+
subject = I18n.t("hidden_automatically.subject", scope: "decidim.reported_mailer")
|
32
47
|
mail(to: user.email, subject:)
|
33
48
|
end
|
34
49
|
end
|
@@ -1 +1 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="Layer_1" width="200" height="200" x="0" y="0" enable-background="new 0 0 200 200" version="1.1" viewBox="0 0 200 200" xml:space="preserve"><g><path fill="#
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="Layer_1" width="200" height="200" x="0" y="0" enable-background="new 0 0 200 200" version="1.1" viewBox="0 0 200 200" xml:space="preserve"><g><path fill="#908e8e" d="M200-0.5H0v200h26.099c2.885-35.293,24.07-64.381,52.419-74.319C64.372,117.596,54.75,102.674,54.75,85.5 c0-24.853,20.146-45,45-45c24.853,0,45,20.147,45,45c0,17.095-9.533,31.963-23.572,39.58c28.5,9.837,49.828,39.002,52.724,74.42 H200V-0.5z"/><path fill="#FFF" d="M121.178,125.08c14.039-7.617,23.572-22.485,23.572-39.58c0-24.853-20.147-45-45-45 c-24.854,0-45,20.147-45,45c0,17.174,9.622,32.096,23.768,39.681c-28.349,9.938-49.534,39.026-52.419,74.319h147.803 C171.006,164.082,149.678,134.917,121.178,125.08z"/></g></svg>
|