decidim-core 0.31.6 → 0.32.0.rc1
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/README.md +3 -13
- data/app/cells/decidim/amendable/amend_button_card/show.erb +2 -2
- data/app/cells/decidim/amendable/amend_button_card_cell.rb +1 -1
- data/app/cells/decidim/author_cell.rb +4 -0
- data/app/cells/decidim/content_blocks/announcement_settings_form/show.erb +5 -0
- data/app/cells/decidim/content_blocks/announcement_settings_form_cell.rb +17 -0
- 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/how_to_participate/show.erb +1 -1
- data/app/cells/decidim/content_blocks/html_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/participatory_space_announcement_cell.rb +1 -3
- data/app/cells/decidim/content_blocks/participatory_space_hero_cell.rb +1 -5
- data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form/show.erb +1 -1
- data/app/cells/decidim/content_blocks/static_page/section_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/static_page/section_settings_form/show.erb +1 -3
- data/app/cells/decidim/content_blocks/static_page/summary_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/static_page/summary_settings_form/show.erb +1 -3
- data/app/cells/decidim/content_blocks/static_page/two_pane_section_cell.rb +2 -2
- data/app/cells/decidim/content_blocks/static_page/two_pane_section_settings_form/show.erb +2 -4
- data/app/cells/decidim/data_consent/category.erb +5 -5
- data/app/cells/decidim/{participatory_space_private_user_cell.rb → member_cell.rb} +1 -1
- data/app/cells/decidim/onboarding_action_message_cell.rb +1 -0
- data/app/cells/decidim/profile/details.erb +1 -1
- data/app/cells/decidim/profile_cell.rb +1 -0
- data/app/cells/decidim/profile_member_of/show.erb +13 -0
- data/app/cells/decidim/profile_member_of_cell.rb +35 -0
- data/app/cells/decidim/resource_types_filter/show.erb +2 -2
- data/app/cells/decidim/tags_cell.rb +1 -1
- data/app/cells/decidim/upload_modal_cell.rb +0 -5
- data/app/cells/decidim/versions_list/show.erb +25 -0
- data/app/commands/decidim/create_follow.rb +3 -5
- data/app/commands/decidim/create_user_report.rb +1 -1
- data/app/commands/decidim/destroy_account.rb +4 -15
- data/app/commands/decidim/gallery_methods.rb +107 -0
- data/app/commands/decidim/multiple_attachments_methods.rb +27 -28
- data/app/commands/decidim/search.rb +5 -5
- data/app/controllers/concerns/decidim/ajax_permission_handler.rb +1 -1
- data/app/controllers/concerns/decidim/devise_controllers.rb +0 -10
- data/app/controllers/concerns/decidim/direct_upload.rb +3 -2
- data/app/controllers/concerns/decidim/ephemeral_session_checker.rb +1 -1
- data/app/controllers/concerns/decidim/force_authentication.rb +10 -1
- data/app/controllers/concerns/decidim/impersonate_users.rb +4 -0
- data/app/controllers/concerns/decidim/locale_switcher.rb +52 -2
- data/app/controllers/concerns/decidim/needs_tos_accepted.rb +1 -1
- data/app/controllers/concerns/decidim/participatory_space/has_members_page.rb +27 -0
- data/app/controllers/concerns/decidim/participatory_space_context.rb +1 -5
- data/app/controllers/decidim/account_controller.rb +1 -1
- data/app/controllers/decidim/amendments_controller.rb +5 -4
- data/app/controllers/decidim/components/base_controller.rb +20 -3
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -1
- data/app/controllers/decidim/devise/passwords_controller.rb +1 -1
- data/app/controllers/decidim/devise/registrations_controller.rb +1 -1
- data/app/controllers/decidim/devise/sessions_controller.rb +1 -1
- data/app/controllers/decidim/download_your_data_controller.rb +2 -2
- data/app/controllers/decidim/editor_images_controller.rb +1 -1
- data/app/controllers/decidim/follows_controller.rb +4 -3
- data/app/controllers/decidim/geolocation_controller.rb +1 -1
- data/app/controllers/decidim/likes_controller.rb +2 -1
- data/app/controllers/decidim/locales_controller.rb +3 -11
- data/app/controllers/decidim/messaging/conversations_controller.rb +3 -3
- data/app/controllers/decidim/newsletters_controller.rb +1 -1
- data/app/controllers/decidim/notifications_settings_controller.rb +1 -1
- data/app/controllers/decidim/notifications_subscriptions_controller.rb +0 -8
- data/app/controllers/decidim/open_data_controller.rb +1 -1
- data/app/controllers/decidim/report_users_controller.rb +2 -2
- data/app/controllers/decidim/reports_controller.rb +1 -1
- data/app/controllers/decidim/user_activities_controller.rb +1 -2
- data/app/events/decidim/welcome_notification_event.rb +1 -1
- data/app/forms/decidim/upload_validation_form.rb +1 -1
- data/app/helpers/concerns/decidim/flash_helper_extensions.rb +1 -0
- data/app/helpers/decidim/active_link_to_helper.rb +136 -0
- data/app/helpers/decidim/amendments_helper.rb +3 -3
- data/app/helpers/decidim/check_boxes_tree_helper.rb +2 -2
- data/app/helpers/decidim/component_path_helper.rb +9 -4
- data/app/helpers/decidim/filters_helper.rb +0 -2
- data/app/helpers/decidim/menu_helper.rb +3 -3
- data/app/helpers/decidim/meta_tags_helper.rb +0 -2
- data/app/helpers/decidim/paginate_helper.rb +14 -1
- data/app/helpers/decidim/sanitize_helper.rb +1 -0
- data/app/helpers/decidim/short_link_helper.rb +5 -5
- data/app/helpers/decidim/translations_helper.rb +4 -4
- data/app/jobs/decidim/delete_inactive_participants_job.rb +2 -2
- data/app/jobs/decidim/process_inactive_participant_job.rb +7 -0
- data/app/mailers/decidim/application_mailer.rb +7 -2
- data/app/mailers/decidim/decidim_devise_mailer.rb +1 -0
- data/app/mailers/decidim/participants_account_mailer.rb +16 -0
- data/app/mailers/decidim/reported_mailer.rb +4 -1
- data/app/models/decidim/action_log.rb +1 -1
- data/app/models/decidim/attachment.rb +2 -20
- data/app/models/decidim/authorization.rb +0 -7
- data/app/models/decidim/authorization_transfer.rb +1 -1
- data/app/models/decidim/component.rb +6 -9
- data/app/models/decidim/content_block.rb +3 -3
- data/app/models/decidim/moderation.rb +1 -1
- data/app/models/decidim/newsletter.rb +2 -2
- data/app/models/decidim/participatory_space/member.rb +55 -0
- data/app/models/decidim/private_export.rb +0 -6
- data/app/models/decidim/resource_link.rb +1 -1
- data/app/models/decidim/short_link.rb +1 -1
- data/app/models/decidim/user_base_entity.rb +2 -17
- data/app/models/decidim/user_moderation.rb +1 -1
- data/app/packs/src/decidim/controllers/assign_role/assign_role.test.js +80 -0
- data/app/packs/src/decidim/controllers/assign_role/controller.js +27 -0
- 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 +1 -23
- data/app/packs/src/decidim/controllers/main_menu/controller.js +115 -0
- data/app/packs/src/decidim/controllers/main_menu/main_menu.test.js +185 -0
- data/app/packs/src/decidim/controllers/mention/controller.js +140 -296
- data/app/packs/src/decidim/controllers/mention/input_mentions.test.js +457 -120
- data/app/packs/src/decidim/controllers/multiple_mentions/controller.js +32 -68
- data/app/packs/src/decidim/controllers/multiple_mentions/input_multiple_mentions.test.js +23 -30
- data/app/packs/src/decidim/datepicker/generate_datepicker.js +1 -13
- data/app/packs/src/decidim/direct_uploads/upload_field.js +4 -4
- data/app/packs/src/decidim/direct_uploads/upload_modal.js +7 -11
- data/app/packs/src/decidim/editor/common/suggestion.js +1 -1
- data/app/packs/src/decidim/editor/extensions/decidim_kit/index.js +4 -1
- data/app/packs/src/decidim/editor/extensions/image/index.js +8 -5
- data/app/packs/src/decidim/editor/extensions/link/index.js +8 -0
- data/app/packs/src/decidim/editor/extensions/mention/index.js +18 -5
- data/app/packs/src/decidim/editor/extensions/mention_resource/index.js +16 -7
- data/app/packs/src/decidim/editor/test/extensions/decidim_kit.test.js +13 -4
- data/app/packs/src/decidim/editor/test/extensions/heading.test.js +1 -1
- data/app/packs/src/decidim/editor/test/extensions/image.test.js +26 -28
- data/app/packs/src/decidim/editor/test/extensions/mention.test.js +6 -2
- data/app/packs/src/decidim/editor/test/extensions/video_embed.test.js +27 -15
- data/app/packs/src/decidim/editor/test/helpers.js +8 -10
- data/app/packs/src/decidim/editor/test/toolbar/full.test.js +15 -4
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_block.js +8 -4
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_formatting.js +5 -1
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_indent.js +9 -5
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_link.js +5 -1
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_list.js +8 -4
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_styling.js +13 -9
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content_styling.js +6 -2
- data/app/packs/src/decidim/geocoding/reverse_geocoding.js +5 -15
- data/app/packs/src/decidim/index.js +3 -5
- data/app/packs/src/decidim/sw/push-permissions.js +13 -48
- data/app/packs/src/decidim/sw/sw.js +1 -1
- data/app/packs/src/decidim/utilities/text.js +6 -6
- data/app/packs/src/decidim/vendor/tribute.js +1890 -0
- data/app/packs/stylesheets/decidim/_cards.scss +2 -1
- data/app/packs/stylesheets/decidim/_conversations.scss +0 -14
- data/app/packs/stylesheets/decidim/_datepicker.scss +0 -8
- data/app/packs/stylesheets/decidim/_dropdown.scss +21 -31
- data/app/packs/stylesheets/decidim/_floating_help.scss +1 -1
- data/app/packs/stylesheets/decidim/_footer.scss +0 -36
- data/app/packs/stylesheets/decidim/_forms.scss +5 -1
- data/app/packs/stylesheets/decidim/_header.scss +148 -46
- data/app/packs/stylesheets/decidim/_language_chooser.scss +79 -0
- data/app/packs/stylesheets/decidim/_tribute.scss +36 -0
- data/app/packs/stylesheets/decidim/application.scss +1 -2
- data/app/packs/stylesheets/decidim/editor.scss +33 -2
- data/app/packs/stylesheets/decidim/geocoding_addons.scss +2 -10
- data/app/presenters/decidim/admin_log/participatory_space/member_presenter.rb +40 -0
- data/app/presenters/decidim/admin_log/static_page_resource_presenter.rb +1 -1
- data/app/presenters/decidim/authorization_transfer_presenter.rb +1 -1
- data/app/presenters/decidim/breadcrumb_root_menu_item_presenter.rb +3 -3
- data/app/presenters/decidim/log/user_presenter.rb +1 -0
- data/app/presenters/decidim/log/value_types/access_mode_presenter.rb +45 -0
- data/app/presenters/decidim/menu_item_presenter.rb +3 -9
- data/app/presenters/decidim/participatory_space/member_presenter.rb +48 -0
- data/app/presenters/decidim/resource_locator_presenter.rb +22 -3
- data/app/presenters/decidim/stats_presenter.rb +1 -1
- data/app/queries/decidim/last_activity.rb +1 -1
- data/app/serializers/decidim/exporters/participatory_space_serializer.rb +15 -1
- data/app/services/decidim/email_notification_generator.rb +2 -0
- data/app/services/decidim/notification_generator.rb +4 -0
- data/app/services/decidim/notifications_subscriptions_persistor.rb +0 -6
- data/app/services/decidim/send_push_notification.rb +1 -5
- data/app/uploaders/decidim/image_uploader.rb +1 -1
- data/app/uploaders/decidim/organization_favicon_uploader.rb +4 -9
- data/app/validators/uploader_image_dimensions_validator.rb +13 -11
- data/app/views/decidim/gamification/badges/index.html.erb +1 -1
- data/app/views/decidim/homepage/show.html.erb +2 -2
- data/app/views/decidim/last_activities/index.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_error_modal.html.erb +19 -11
- data/app/views/decidim/messaging/conversations/_new_conversation_button.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_reply.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/error.js.erb +7 -12
- data/app/views/decidim/messaging/conversations/new.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/show.html.erb +2 -2
- data/app/views/decidim/newsletters/unsubscribe.html.erb +1 -1
- data/app/views/decidim/notifications_settings/show.html.erb +5 -5
- data/app/views/decidim/offline/show.html.erb +1 -1
- data/app/views/decidim/pages/index.html.erb +1 -1
- data/app/views/decidim/participants_account_mailer/removal_notification.html.erb +11 -0
- data/app/views/decidim/participatory_space/members/_member.html.erb +1 -0
- 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/shared/_results_per_page.html.erb +1 -1
- data/app/views/decidim/shared/filters/_check_boxes_tree.html.erb +1 -1
- data/app/views/decidim/shared/filters/_dropdown_label.html.erb +4 -3
- data/app/views/decidim/user_activities/index.html.erb +1 -1
- data/app/views/devise/mailer/{invite_private_user.html.erb → invite_member.html.erb} +2 -2
- data/app/views/devise/mailer/{invite_private_user.text.erb → invite_member.text.erb} +2 -2
- data/app/views/layouts/decidim/_head.html.erb +2 -2
- data/app/views/layouts/decidim/_wrapper.html.erb +3 -3
- data/app/views/layouts/decidim/footer/_focus_mode_main.html.erb +0 -1
- data/app/views/layouts/decidim/footer/_main.html.erb +0 -1
- data/app/views/layouts/decidim/header/_focus_mode_back_button.html.erb +4 -1
- data/app/views/layouts/decidim/header/_main.html.erb +17 -8
- data/app/views/layouts/decidim/header/_main_language_chooser.html.erb +24 -0
- data/app/views/layouts/decidim/header/_main_links_desktop.html.erb +56 -56
- data/app/views/layouts/decidim/header/_main_links_mobile_account.html.erb +2 -2
- data/app/views/layouts/decidim/header/_main_links_mobile_item_account.html.erb +3 -1
- data/app/views/layouts/decidim/header/_main_menu_mobile.html.erb +18 -5
- data/app/views/layouts/decidim/header/_main_search.html.erb +3 -3
- data/app/views/layouts/decidim/header/_menu.html.erb +5 -5
- data/app/views/layouts/decidim/header/_menu_breadcrumb_desktop.html.erb +13 -12
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile.html.erb +28 -0
- 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/initializers/invisible_captcha.rb +1 -0
- data/config/locales/ar.yml +9 -12
- data/config/locales/bg.yml +12 -14
- data/config/locales/bs-BA.yml +0 -1
- data/config/locales/ca-IT.yml +46 -33
- data/config/locales/ca.yml +46 -33
- data/config/locales/cs.yml +38 -27
- data/config/locales/da.yml +0 -1
- data/config/locales/de.yml +33 -27
- data/config/locales/el.yml +8 -9
- data/config/locales/en.yml +42 -28
- data/config/locales/eo.yml +0 -1
- data/config/locales/es-MX.yml +45 -32
- data/config/locales/es-PY.yml +45 -32
- data/config/locales/es.yml +45 -32
- data/config/locales/et.yml +0 -1
- data/config/locales/eu.yml +84 -71
- data/config/locales/fa-IR.yml +0 -1
- data/config/locales/fi-plain.yml +40 -32
- data/config/locales/fi.yml +42 -34
- data/config/locales/fr-CA.yml +45 -33
- data/config/locales/fr.yml +45 -33
- data/config/locales/ga-IE.yml +3 -2
- data/config/locales/gl.yml +7 -9
- data/config/locales/gn-PY.yml +0 -1
- data/config/locales/hr.yml +0 -1
- data/config/locales/hu.yml +9 -12
- data/config/locales/id-ID.yml +7 -9
- data/config/locales/is-IS.yml +1 -2
- data/config/locales/it.yml +7 -23
- data/config/locales/ja.yml +42 -47
- data/config/locales/ka-GE.yml +0 -1
- data/config/locales/kaa.yml +0 -1
- data/config/locales/ko.yml +0 -1
- data/config/locales/lb.yml +9 -10
- data/config/locales/lt.yml +9 -12
- data/config/locales/lv.yml +7 -9
- data/config/locales/mt.yml +0 -1
- data/config/locales/nl.yml +9 -10
- data/config/locales/no.yml +9 -10
- data/config/locales/oc-FR.yml +0 -1
- data/config/locales/pl.yml +14 -16
- data/config/locales/pt-BR.yml +36 -26
- data/config/locales/pt.yml +9 -10
- data/config/locales/ro-RO.yml +25 -21
- data/config/locales/ru.yml +0 -7
- data/config/locales/sk.yml +8 -1417
- data/config/locales/sl.yml +0 -1
- data/config/locales/sr-CS.yml +0 -1
- data/config/locales/sv.yml +47 -26
- data/config/locales/tr-TR.yml +10 -10
- data/config/locales/uk.yml +0 -4
- data/config/locales/vi.yml +0 -1
- data/config/locales/zh-CN.yml +9 -9
- data/config/locales/zh-TW.yml +9 -10
- data/config/routes.rb +138 -77
- data/db/data/20251213075429_rename_members_in_action_log.rb +22 -0
- data/db/data/20260319145808_rename_send_to_members_in_newsletter.rb +27 -0
- data/db/migrate/20200730142511_add_file_upload_settings_to_decidim_organizations.rb +13 -15
- data/db/migrate/20250523104311_move_cta_to_hero_content_block.rb +1 -1
- data/db/migrate/20250527122040_move_highlighted_content_banner_settings_to_content_block.rb +1 -1
- data/db/migrate/20250819110800_convert_private_exports_id_to_uuid.rb +2 -2
- data/db/migrate/20251112132305_remove_legacy_images_from_core_module.rb +27 -0
- data/db/migrate/20251205122428_rename_participatory_space_private_users_to_members.rb +9 -0
- data/db/migrate/20251216185133_rename_privatable_to_to_participatory_space_in_members.rb +10 -0
- data/db/migrate/20260208201405_remove_user_group_core.rb +21 -0
- data/db/migrate/20260208201406_remove_user_group_memberships.rb +30 -0
- data/db/migrate/20260208201407_remove_user_group_organizations.rb +11 -0
- data/db/migrate/20260217152425_remove_enable_participatory_space_filters_from_decidim_organizations.rb +7 -0
- data/db/migrate/20260314081619_add_index_on_decidim_members.rb +25 -0
- data/decidim-core.gemspec +25 -28
- data/lib/decidim/acts_as_tree.rb +12 -12
- data/lib/decidim/admin_filters_registry.rb +1 -1
- data/lib/decidim/amendable.rb +5 -1
- data/lib/decidim/api/functions/category_list.rb +1 -0
- data/lib/decidim/api/functions/component_finder_base.rb +1 -1
- data/lib/decidim/api/functions/component_list.rb +3 -1
- data/lib/decidim/api/functions/component_list_base.rb +1 -0
- data/lib/decidim/api/functions/participatory_space_finder_base.rb +1 -1
- data/lib/decidim/api/functions/participatory_space_list_base.rb +1 -0
- data/lib/decidim/api/functions/user_entity_list.rb +0 -3
- data/lib/decidim/api/interfaces/amendable_entity_interface.rb +1 -0
- data/lib/decidim/api/interfaces/amendable_interface.rb +1 -0
- data/lib/decidim/api/interfaces/attachable_collection_interface.rb +1 -0
- data/lib/decidim/api/interfaces/attachable_interface.rb +1 -0
- data/lib/decidim/api/interfaces/author_interface.rb +2 -1
- data/lib/decidim/api/interfaces/authorable_interface.rb +1 -0
- data/lib/decidim/api/interfaces/categories_container_interface.rb +1 -0
- data/lib/decidim/api/interfaces/categorizable_interface.rb +1 -0
- data/lib/decidim/api/interfaces/coauthorable_interface.rb +1 -0
- data/lib/decidim/api/interfaces/component_interface.rb +9 -8
- data/lib/decidim/api/interfaces/fingerprint_interface.rb +1 -0
- data/lib/decidim/api/interfaces/followable_interface.rb +2 -0
- data/lib/decidim/api/interfaces/likeable_interface.rb +2 -2
- data/lib/decidim/api/interfaces/localizable_interface.rb +1 -0
- data/lib/decidim/api/interfaces/participatory_space_interface.rb +1 -0
- data/lib/decidim/api/interfaces/referable_interface.rb +1 -0
- data/lib/decidim/api/interfaces/scopable_interface.rb +1 -0
- data/lib/decidim/api/interfaces/taxonomizable_interface.rb +1 -0
- data/lib/decidim/api/interfaces/timestamps_interface.rb +1 -0
- data/lib/decidim/api/interfaces/traceable_interface.rb +1 -0
- data/lib/decidim/api/types/attachment_collection_type.rb +5 -3
- data/lib/decidim/api/types/attachment_type.rb +11 -4
- data/lib/decidim/api/types/badge_score_type.rb +28 -0
- data/lib/decidim/api/types/moderation_type.rb +25 -0
- data/lib/decidim/api/types/participant_details_type.rb +17 -0
- data/lib/decidim/api/types/reportable_type.rb +18 -0
- data/lib/decidim/api/types/reportable_user_type.rb +17 -0
- data/lib/decidim/api/types/static_page_topic_type.rb +16 -0
- data/lib/decidim/api/types/static_page_type.rb +22 -0
- data/lib/decidim/api/types/taxonomy_type.rb +2 -0
- data/lib/decidim/api/types/user_moderation_type.rb +36 -0
- data/lib/decidim/api/types/user_type.rb +13 -0
- data/lib/decidim/asset_router/pipeline.rb +1 -1
- data/lib/decidim/asset_router/storage.rb +9 -9
- data/lib/decidim/assets/tailwind/tailwind.config.js.erb +3 -0
- data/lib/decidim/attachment_attributes.rb +9 -58
- data/lib/decidim/attribute_encryptor.rb +51 -10
- data/lib/decidim/attribute_object/model.rb +0 -5
- data/lib/decidim/block_registry.rb +1 -1
- data/lib/decidim/coauthorable.rb +2 -1
- data/lib/decidim/command.rb +2 -1
- data/lib/decidim/content_processor.rb +1 -1
- data/lib/decidim/content_renderers/base_renderer.rb +0 -112
- data/lib/decidim/content_renderers/blob_renderer.rb +7 -4
- data/lib/decidim/content_renderers/mention_resource_renderer.rb +6 -10
- data/lib/decidim/content_renderers/resource_renderer.rb +7 -16
- data/lib/decidim/content_renderers/user_renderer.rb +9 -11
- data/lib/decidim/core/api.rb +8 -0
- data/lib/decidim/core/content_blocks/registry_manager.rb +4 -10
- data/lib/decidim/core/engine.rb +2 -42
- data/lib/decidim/core/menu.rb +0 -26
- data/lib/decidim/core/test/factories.rb +29 -21
- data/lib/decidim/core/test/shared_examples/access_mode_restricted_participatory_spaces.rb +172 -0
- data/lib/decidim/core/test/shared_examples/access_mode_transparent_participatory_spaces.rb +241 -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 +121 -117
- data/lib/decidim/core/test/shared_examples/fingerprint_examples.rb +2 -0
- data/lib/decidim/core/test/shared_examples/has_members.rb +63 -0
- data/lib/decidim/core/test/shared_examples/manage_share_tokens_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/map_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/participant_details_examples.rb +16 -0
- data/lib/decidim/core/test/shared_examples/participatory_space_members_page_examples.rb +10 -10
- data/lib/decidim/core/test/shared_examples/resource_liked_event_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/resource_locator_presenter_examples.rb +7 -7
- data/lib/decidim/core/test/shared_examples/searchable_participatory_space_examples.rb +3 -3
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/simple_event.rb +1 -0
- data/lib/decidim/core/test/shared_examples/translated_event_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +1 -1
- data/lib/decidim/core/test.rb +2 -1
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +222 -335
- data/lib/decidim/download_your_data_serializers/{download_your_data_participatory_space_private_user_serializer.rb → download_your_data_member_serializer.rb} +6 -6
- data/lib/decidim/download_your_data_serializers.rb +2 -2
- data/lib/decidim/engine_router.rb +31 -6
- data/lib/decidim/exporters/csv.rb +1 -1
- data/lib/decidim/filter_form_builder.rb +1 -1
- data/{app/controllers/concerns → lib}/decidim/form_factory.rb +11 -1
- data/lib/decidim/has_settings.rb +2 -2
- data/lib/decidim/legacy_form_builder.rb +1 -0
- data/lib/decidim/locale_router_detector.rb +41 -0
- data/lib/decidim/maintenance/import_models/scope.rb +1 -1
- data/lib/decidim/maintenance/import_models.rb +0 -2
- data/lib/decidim/map/autocomplete.rb +3 -4
- data/lib/decidim/map/frontend.rb +1 -1
- data/lib/decidim/map/geocoding.rb +2 -2
- data/lib/decidim/map/static_map.rb +10 -22
- data/lib/decidim/map/utility.rb +3 -6
- data/lib/decidim/map.rb +2 -2
- data/lib/decidim/menu.rb +1 -1
- data/lib/decidim/menu_item.rb +1 -0
- data/lib/decidim/menu_registry.rb +1 -1
- data/lib/decidim/moderation_tools.rb +1 -1
- data/lib/decidim/newsletter_encryptor.rb +5 -8
- data/lib/decidim/organization_settings.rb +2 -2
- data/lib/decidim/participable.rb +1 -0
- data/lib/decidim/participatory_space/has_members.rb +61 -0
- data/lib/decidim/participatory_space_manifest.rb +0 -4
- data/lib/decidim/participatory_space_resourceable.rb +10 -1
- data/lib/decidim/routes/locale_redirects.rb +47 -0
- data/lib/decidim/routes.rb +7 -0
- data/lib/decidim/search_resource_fields_mapper.rb +3 -4
- data/lib/decidim/searchable.rb +0 -5
- data/lib/decidim/seeds.rb +17 -0
- data/lib/decidim/shakapacker/runner.rb +4 -4
- data/lib/decidim/shakapacker/shakapacker.yml +28 -3
- data/lib/decidim/taxonomizable.rb +1 -1
- data/lib/decidim/translatable_attributes.rb +9 -3
- data/lib/decidim/view_model.rb +5 -1
- data/lib/devise/models/decidim_newsletterable.rb +1 -1
- data/lib/tasks/decidim_mailers_tasks.rake +9 -31
- data/lib/tasks/decidim_procfile.rake +1 -1
- data/lib/tasks/decidim_tasks.rake +0 -1
- data/lib/tasks/decidim_taxonomies.rake +1 -1
- data/lib/tasks/upgrade/decidim_active_storage_migration_tasks.rake +0 -1
- data/lib/tasks/upgrade/decidim_encryption.rake +12 -0
- data/lib/tasks/upgrade/decidim_migrate_wysiwyg_content.rake +0 -1
- data/lib/tasks/upgrade/decidim_remove_deleted_users_left_data_tasks.rake +1 -1
- data/lib/tasks/upgrade/{fix_deleted_private_follows.rake → fix_deleted_members_follows.rake} +5 -5
- data/lib/tasks/upgrade/migrations.rake +0 -1
- data/lib/tasks/upgrade/user_groups_migration.rake +0 -1
- metadata +210 -138
- data/app/cells/decidim/content_blocks/global_menu/show.erb +0 -11
- data/app/cells/decidim/content_blocks/global_menu_cell.rb +0 -35
- data/app/cells/decidim/content_blocks/menu_breadcrumb_last_activity/show.erb +0 -10
- data/app/cells/decidim/content_blocks/menu_breadcrumb_last_activity_cell.rb +0 -49
- data/app/cells/decidim/participatory_space_dropdown_metadata/links.erb +0 -9
- data/app/cells/decidim/participatory_space_dropdown_metadata/metadata.erb +0 -1
- data/app/cells/decidim/participatory_space_dropdown_metadata/show.erb +0 -11
- data/app/cells/decidim/participatory_space_dropdown_metadata_cell.rb +0 -26
- data/app/controllers/concerns/decidim/has_members_page.rb +0 -25
- data/app/controllers/decidim/private_downloads_controller.rb +0 -29
- data/app/jobs/decidim/newsletters_opt_in_job.rb +0 -11
- data/app/jobs/decidim/user_report_job.rb +0 -11
- data/app/mailers/decidim/delete_user_mailer.rb +0 -14
- data/app/models/decidim/participatory_space_private_user.rb +0 -51
- data/app/models/decidim/private_download.rb +0 -61
- data/app/packs/src/decidim/controllers/sticky_header/controller.js +0 -116
- data/app/packs/src/decidim/controllers/sticky_header/sticky_header.test.js +0 -320
- data/app/packs/src/decidim/dropdown_menu.js +0 -18
- data/app/packs/src/decidim/geocoding/reverse_geocoding.test.js +0 -197
- data/app/packs/src/decidim/identity_selector_dialog.js +0 -33
- data/app/packs/stylesheets/decidim/_editor_suggestions.scss +0 -49
- data/app/packs/stylesheets/decidim/_tom_select.scss +0 -23
- data/app/presenters/decidim/admin_log/participatory_space_private_user_presenter.rb +0 -38
- data/app/presenters/decidim/participatory_space_private_user_presenter.rb +0 -46
- data/app/services/decidim/push_subscription_endpoint_validator.rb +0 -34
- data/app/views/decidim/delete_user_mailer/delete.html.erb +0 -6
- data/app/views/decidim/participatory_space_private_users/_participatory_space_private_user.html.erb +0 -1
- data/app/views/layouts/decidim/footer/_main_language_chooser.html.erb +0 -26
- data/app/views/layouts/decidim/header/_menu_breadcrumb_items.html.erb +0 -34
- data/app/views/layouts/decidim/header/_menu_breadcrumb_main_dropdown_desktop.html.erb +0 -10
- data/app/views/layouts/decidim/header/_menu_breadcrumb_main_dropdown_mobile.html.erb +0 -17
- data/app/views/layouts/decidim/header/_menu_breadcrumb_main_dropdown_top_left.html.erb +0 -2
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +0 -33
- data/app/views/layouts/decidim/header/_mobile_language_choose.html.erb +0 -25
- data/lib/decidim/core/test/shared_examples/has_private_users.rb +0 -63
- data/lib/decidim/core/test/shared_examples/participatory_space_dropdown_metadata_cell_examples.rb +0 -81
- data/lib/decidim/has_private_users.rb +0 -57
- data/lib/decidim/maintenance/import_models/assembly_type.rb +0 -49
- data/lib/decidim/maintenance/import_models/participatory_process_type.rb +0 -21
- data/lib/decidim/query_extensions.rb +0 -64
- /data/app/cells/decidim/{participatory_space_private_user → member}/show.erb +0 -0
|
@@ -5,16 +5,16 @@ module Decidim
|
|
|
5
5
|
private
|
|
6
6
|
|
|
7
7
|
def build_attachments
|
|
8
|
-
@
|
|
9
|
-
@form.
|
|
8
|
+
@documents = []
|
|
9
|
+
@form.add_documents.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
|
+
@documents << Attachment.new(
|
|
16
16
|
title: title_for(attachment),
|
|
17
|
-
attached_to: @attached_to ||
|
|
17
|
+
attached_to: @attached_to || documents_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
|
+
@documents.each do |document|
|
|
30
|
+
next if document.valid? || !document.errors.has_key?(:file)
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
@form.errors.add(:
|
|
32
|
+
document.errors[:file].each do |error|
|
|
33
|
+
@form.errors.add(:add_documents, error)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
return true
|
|
@@ -41,38 +41,37 @@ 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 documents
|
|
45
|
+
document_ids = keep_ids
|
|
46
|
+
Decidim::Attachment.where(id: document_ids).each do |document|
|
|
47
|
+
document.update!(weight:)
|
|
48
48
|
weight += 1
|
|
49
49
|
end
|
|
50
|
-
@
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
@documents.map! do |document|
|
|
51
|
+
document.weight = weight
|
|
52
|
+
document.attached_to = documents_attached_to
|
|
53
|
+
document.save!
|
|
54
54
|
weight += 1
|
|
55
|
-
@form.
|
|
55
|
+
@form.documents << document
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
def
|
|
60
|
-
|
|
59
|
+
def document_cleanup!(include_all_attachments: false)
|
|
60
|
+
documents = include_all_attachments ? documents_attached_to.attachments.with_attached_file : documents_attached_to.documents
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
documents.each do |document|
|
|
63
|
+
document.destroy! unless keep_ids.include?(document.id)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
attachments_attached_to.instance_variable_set(:@photos, nil)
|
|
66
|
+
documents_attached_to.reload
|
|
67
|
+
documents_attached_to.instance_variable_set(:@documents, nil)
|
|
69
68
|
end
|
|
70
69
|
|
|
71
70
|
def process_attachments?
|
|
72
|
-
@form.
|
|
71
|
+
@form.add_documents.any?
|
|
73
72
|
end
|
|
74
73
|
|
|
75
|
-
def
|
|
74
|
+
def documents_attached_to
|
|
76
75
|
return @attached_to if @attached_to.present?
|
|
77
76
|
return form.current_organization if form.respond_to?(:current_organization)
|
|
78
77
|
|
|
@@ -102,8 +101,8 @@ module Decidim
|
|
|
102
101
|
end
|
|
103
102
|
|
|
104
103
|
def keep_ids
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
documents_array = Array(@form.documents)
|
|
105
|
+
documents_array.map do |doc|
|
|
107
106
|
case doc
|
|
108
107
|
when Decidim::Attachment
|
|
109
108
|
doc.id
|
|
@@ -7,10 +7,10 @@ module Decidim
|
|
|
7
7
|
|
|
8
8
|
# Public: Initializes the command.
|
|
9
9
|
#
|
|
10
|
-
# @param term
|
|
11
|
-
# @param organization
|
|
12
|
-
# @param filters
|
|
13
|
-
# @param page_params
|
|
10
|
+
# @param term [String] - The term to search for.
|
|
11
|
+
# @param organization [Decidim::Organization] - The Organization to which the results are constrained.
|
|
12
|
+
# @param filters [Hash] - (optional) A Hash of SearchableResource attributes to filter for.
|
|
13
|
+
# @param page_params [Hash] - (optional) A Hash with `page` and `per_page` options to paginate.
|
|
14
14
|
def initialize(term, organization, filters = {}, page_params = {})
|
|
15
15
|
@term = term
|
|
16
16
|
@organization = organization
|
|
@@ -91,7 +91,7 @@ module Decidim
|
|
|
91
91
|
query = query.where(decidim_participatory_space: spaces)
|
|
92
92
|
end
|
|
93
93
|
|
|
94
|
-
query = query.order(
|
|
94
|
+
query = query.order(datetime: :desc)
|
|
95
95
|
query = query.global_search(I18n.transliterate(term)) if term.present?
|
|
96
96
|
query
|
|
97
97
|
end
|
|
@@ -15,7 +15,7 @@ module Decidim
|
|
|
15
15
|
def ajax_user_has_no_permission
|
|
16
16
|
return user_has_no_permission unless request.xhr?
|
|
17
17
|
|
|
18
|
-
render json: { message: I18n.t("actions.unauthorized", scope: "decidim.core") }, status: :
|
|
18
|
+
render json: { message: I18n.t("actions.unauthorized", scope: "decidim.core") }, status: :unprocessable_content
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -41,10 +41,6 @@ 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
|
-
|
|
48
44
|
# Saves the location before loading each page so we can return to the
|
|
49
45
|
# right page.
|
|
50
46
|
before_action :store_current_location
|
|
@@ -62,12 +58,6 @@ module Decidim
|
|
|
62
58
|
|
|
63
59
|
store_location_for(:user, redirect_url)
|
|
64
60
|
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
|
|
71
61
|
end
|
|
72
62
|
end
|
|
73
63
|
end
|
|
@@ -6,6 +6,7 @@ module Decidim
|
|
|
6
6
|
|
|
7
7
|
included do
|
|
8
8
|
include Decidim::NeedsOrganization
|
|
9
|
+
|
|
9
10
|
skip_before_action :verify_organization
|
|
10
11
|
|
|
11
12
|
before_action :check_organization!,
|
|
@@ -18,14 +19,14 @@ module Decidim
|
|
|
18
19
|
# We skip the validation if we are in system panel. `current_admin` refers to the main system admin user.
|
|
19
20
|
return if current_admin.present?
|
|
20
21
|
|
|
21
|
-
head :
|
|
22
|
+
head :unprocessable_content unless [
|
|
22
23
|
maximum_allowed_size.try(:to_i) >= blob_args[:byte_size].try(:to_i),
|
|
23
24
|
content_types.any? { |pattern| pattern.match?(blob_args[:content_type]) },
|
|
24
25
|
content_types.any? { |pattern| pattern.match?(MiniMime.lookup_by_extension(extension)&.content_type) },
|
|
25
26
|
allowed_extensions.any? { |pattern| pattern.match?(extension) }
|
|
26
27
|
].all?
|
|
27
28
|
rescue NoMethodError
|
|
28
|
-
head :
|
|
29
|
+
head :unprocessable_content
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
def extension
|
|
@@ -78,7 +78,7 @@ module Decidim
|
|
|
78
78
|
end
|
|
79
79
|
paths_list.prepend(
|
|
80
80
|
pending_authorizations_path,
|
|
81
|
-
decidim.page_path(terms_of_service_page)
|
|
81
|
+
decidim.page_path(terms_of_service_page, locale: current_locale)
|
|
82
82
|
)
|
|
83
83
|
|
|
84
84
|
paths_list.find { |el| /\A#{URI.parse(el).path}/.match?(request.path) }
|
|
@@ -38,12 +38,21 @@ module Decidim
|
|
|
38
38
|
default_unauthorized_paths + Decidim::StaticPage.where(
|
|
39
39
|
organization: current_organization,
|
|
40
40
|
allow_public_access: true
|
|
41
|
-
).pluck(
|
|
41
|
+
).pluck(
|
|
42
|
+
Arel::Nodes::Concat.new(
|
|
43
|
+
Arel::Nodes.build_quoted("/#{current_locale}/pages/"),
|
|
44
|
+
Arel::Table.new(Decidim::StaticPage.table_name)[:slug]
|
|
45
|
+
)
|
|
46
|
+
)
|
|
42
47
|
end
|
|
43
48
|
|
|
44
49
|
def default_unauthorized_paths
|
|
45
50
|
# /locale is for changing the locale and /manifest.webmanifest to request PWA manifest
|
|
46
51
|
%w(/locale /manifest.webmanifest)
|
|
47
52
|
end
|
|
53
|
+
|
|
54
|
+
def current_locale
|
|
55
|
+
@current_locale ||= I18n.locale.to_s
|
|
56
|
+
end
|
|
48
57
|
end
|
|
49
58
|
end
|
|
@@ -71,6 +71,10 @@ module Decidim
|
|
|
71
71
|
# Prevent redirect on non-HTML responses, because we want redirect AFTER impersonation.js inits a reload.
|
|
72
72
|
return if request && request.negotiate_mime([Mime[:html]]).blank?
|
|
73
73
|
return unless can_impersonate_users?
|
|
74
|
+
|
|
75
|
+
# Keep the expiration check in sync with the active impersonation log so
|
|
76
|
+
# the redirect happens in the same request when the session just expired.
|
|
77
|
+
impersonation_log&.ensure_not_expired!
|
|
74
78
|
return unless expired_log
|
|
75
79
|
|
|
76
80
|
expired_log.update!(ended_at: Time.current)
|
|
@@ -9,7 +9,7 @@ module Decidim
|
|
|
9
9
|
|
|
10
10
|
included do
|
|
11
11
|
around_action :switch_locale
|
|
12
|
-
helper_method :current_locale, :available_locales, :default_locale
|
|
12
|
+
helper_method :current_locale, :available_locales, :default_locale, :canonical_url
|
|
13
13
|
|
|
14
14
|
# Sets the locale for the current session.
|
|
15
15
|
# Saves current locale in a session variable in case some links are locale-orphaned
|
|
@@ -21,6 +21,7 @@ module Decidim
|
|
|
21
21
|
else
|
|
22
22
|
locale = default_locale
|
|
23
23
|
end
|
|
24
|
+
|
|
24
25
|
I18n.with_locale(locale, &)
|
|
25
26
|
end
|
|
26
27
|
|
|
@@ -29,7 +30,7 @@ module Decidim
|
|
|
29
30
|
#
|
|
30
31
|
# Returns a Hash.
|
|
31
32
|
def default_url_options
|
|
32
|
-
return {} if
|
|
33
|
+
return {} if locale_in_script_name?
|
|
33
34
|
|
|
34
35
|
{ locale: current_locale }
|
|
35
36
|
end
|
|
@@ -99,6 +100,55 @@ module Decidim
|
|
|
99
100
|
end
|
|
100
101
|
lang == "*" ? nil : lang
|
|
101
102
|
end
|
|
103
|
+
|
|
104
|
+
def canonical_url(desired_url, target_locale = default_locale)
|
|
105
|
+
uri = URI(desired_url)
|
|
106
|
+
desired_locale = available_locales.include?(target_locale) ? target_locale : default_locale
|
|
107
|
+
|
|
108
|
+
path_segments = uri.path.split("/").compact_blank
|
|
109
|
+
locale_segment = path_segments.first
|
|
110
|
+
|
|
111
|
+
query = uri.query.to_s.gsub(/locale=[a-zA-Z-]{2,5}/, "")
|
|
112
|
+
|
|
113
|
+
if available_locales.include?(locale_segment)
|
|
114
|
+
path_segments[0] = desired_locale
|
|
115
|
+
|
|
116
|
+
uri.path = "/#{path_segments.join("/")}"
|
|
117
|
+
|
|
118
|
+
if query.present?
|
|
119
|
+
params = URI.decode_www_form(query)
|
|
120
|
+
uri.query = URI.encode_www_form(params)
|
|
121
|
+
else
|
|
122
|
+
uri.query = nil
|
|
123
|
+
end
|
|
124
|
+
elsif uri.host.blank? || uri.host == request.host
|
|
125
|
+
uri.path = if uri.path == "/"
|
|
126
|
+
"/#{desired_locale}"
|
|
127
|
+
else
|
|
128
|
+
"/#{desired_locale}#{uri.path}"
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if query.present?
|
|
132
|
+
params = URI.decode_www_form(query)
|
|
133
|
+
uri.query = URI.encode_www_form(params)
|
|
134
|
+
else
|
|
135
|
+
uri.query = nil
|
|
136
|
+
end
|
|
137
|
+
else
|
|
138
|
+
params = URI.decode_www_form(query) << ["locale", desired_locale]
|
|
139
|
+
uri.query = URI.encode_www_form(params)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
uri.to_s
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def locale_in_script_name?
|
|
146
|
+
script_name = request&.script_name.to_s
|
|
147
|
+
return false if script_name.blank?
|
|
148
|
+
|
|
149
|
+
locale_segment = script_name.split("/").compact_blank.first
|
|
150
|
+
available_locales.include?(locale_segment)
|
|
151
|
+
end
|
|
102
152
|
# rubocop: enable Metrics/CyclomaticComplexity
|
|
103
153
|
# rubocop: enable Metrics/PerceivedComplexity
|
|
104
154
|
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "active_support/concern"
|
|
4
|
+
|
|
5
|
+
module Decidim
|
|
6
|
+
module ParticipatorySpace
|
|
7
|
+
module HasMembersPage
|
|
8
|
+
extend ActiveSupport::Concern
|
|
9
|
+
|
|
10
|
+
included do
|
|
11
|
+
helper_method :collection
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def can_visit_index?
|
|
16
|
+
current_user_can_visit_space? && current_participatory_space.members_public_page?
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def members
|
|
20
|
+
@members ||= current_participatory_space.members.published
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
alias_method :collection, :members
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -36,8 +36,6 @@ module Decidim
|
|
|
36
36
|
# title of the space (mandatory).
|
|
37
37
|
# * url - The url of the resource (optional).
|
|
38
38
|
# * active - Whether the item is active (optional).
|
|
39
|
-
# * dropdown_cell - When this value is present is used to generate a dropdown
|
|
40
|
-
# associated to the item (optional).
|
|
41
39
|
# * resource - The resource of the item. This value is passed to the
|
|
42
40
|
# dropdown cell, so it is mandatory if the dropdown cell is
|
|
43
41
|
# present.
|
|
@@ -48,7 +46,6 @@ module Decidim
|
|
|
48
46
|
label: current_participatory_space.title,
|
|
49
47
|
url: Decidim::ResourceLocatorPresenter.new(current_participatory_space).path,
|
|
50
48
|
active: true,
|
|
51
|
-
dropdown_cell: current_participatory_space_manifest.breadcrumb_cell,
|
|
52
49
|
resource: current_participatory_space
|
|
53
50
|
}
|
|
54
51
|
end
|
|
@@ -79,8 +76,7 @@ module Decidim
|
|
|
79
76
|
|
|
80
77
|
# Method for current user can visit the space (assembly or process)
|
|
81
78
|
def current_user_can_visit_space?
|
|
82
|
-
return true unless current_participatory_space.
|
|
83
|
-
!current_participatory_space.try(:is_transparent?)
|
|
79
|
+
return true unless current_participatory_space.respond_to?(:restricted?) && current_participatory_space.restricted?
|
|
84
80
|
return false unless current_user
|
|
85
81
|
return true if current_user.admin?
|
|
86
82
|
return true if user_has_any_role?(current_user, current_participatory_space, broad_check: true)
|
|
@@ -31,7 +31,7 @@ module Decidim
|
|
|
31
31
|
on(:invalid) do |password|
|
|
32
32
|
fetch_entered_password(password)
|
|
33
33
|
flash[:alert] = t("account.update.error", scope: "decidim")
|
|
34
|
-
render action: :show, status: :
|
|
34
|
+
render action: :show, status: :unprocessable_content
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
end
|
|
@@ -5,6 +5,7 @@ module Decidim
|
|
|
5
5
|
include Decidim::ApplicationHelper
|
|
6
6
|
include FormFactory
|
|
7
7
|
include HasSpecificBreadcrumb
|
|
8
|
+
|
|
8
9
|
helper Decidim::ResourceReferenceHelper
|
|
9
10
|
|
|
10
11
|
before_action :authenticate_user!
|
|
@@ -38,7 +39,7 @@ module Decidim
|
|
|
38
39
|
|
|
39
40
|
on(:invalid) do
|
|
40
41
|
flash.now[:alert] = t("created.error", scope: "decidim.amendments")
|
|
41
|
-
render :new, status: :
|
|
42
|
+
render :new, status: :unprocessable_content
|
|
42
43
|
end
|
|
43
44
|
end
|
|
44
45
|
end
|
|
@@ -62,7 +63,7 @@ module Decidim
|
|
|
62
63
|
|
|
63
64
|
on(:invalid) do
|
|
64
65
|
flash.now[:alert] = t("error", scope: "decidim.amendments.update_draft")
|
|
65
|
-
render :edit_draft, status: :
|
|
66
|
+
render :edit_draft, status: :unprocessable_content
|
|
66
67
|
end
|
|
67
68
|
end
|
|
68
69
|
end
|
|
@@ -100,7 +101,7 @@ module Decidim
|
|
|
100
101
|
|
|
101
102
|
on(:invalid) do
|
|
102
103
|
flash.now[:alert] = t("error", scope: "decidim.amendments.publish_draft")
|
|
103
|
-
render :edit_draft, status: :
|
|
104
|
+
render :edit_draft, status: :unprocessable_content
|
|
104
105
|
end
|
|
105
106
|
end
|
|
106
107
|
end
|
|
@@ -160,7 +161,7 @@ module Decidim
|
|
|
160
161
|
|
|
161
162
|
on(:invalid) do
|
|
162
163
|
flash.now[:alert] = t("accepted.error", scope: "decidim.amendments")
|
|
163
|
-
render :review, status: :
|
|
164
|
+
render :review, status: :unprocessable_content
|
|
164
165
|
end
|
|
165
166
|
end
|
|
166
167
|
end
|
|
@@ -10,6 +10,7 @@ module Decidim
|
|
|
10
10
|
include Decidim::NeedsPermission
|
|
11
11
|
|
|
12
12
|
include ParticipatorySpaceContext
|
|
13
|
+
|
|
13
14
|
before_action :authorize_participatory_space
|
|
14
15
|
|
|
15
16
|
helper Decidim::FiltersHelper
|
|
@@ -35,7 +36,7 @@ module Decidim
|
|
|
35
36
|
|
|
36
37
|
before_action :redirect_unless_feature_private
|
|
37
38
|
|
|
38
|
-
before_action :
|
|
39
|
+
before_action :set_breadcrumb_items
|
|
39
40
|
|
|
40
41
|
def current_participatory_space
|
|
41
42
|
request.env["decidim.current_participatory_space"]
|
|
@@ -66,14 +67,30 @@ module Decidim
|
|
|
66
67
|
raise ActionController::RoutingError, "Not Found" unless current_user_can_visit_space?
|
|
67
68
|
end
|
|
68
69
|
|
|
69
|
-
def
|
|
70
|
-
context_breadcrumb_items <<
|
|
70
|
+
def set_breadcrumb_items
|
|
71
|
+
context_breadcrumb_items << add_current_component
|
|
72
|
+
context_breadcrumb_items << add_parent_breadcrumb_item
|
|
73
|
+
context_breadcrumb_items << add_breadcrumb_item
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
def add_current_component
|
|
79
|
+
{
|
|
71
80
|
label: current_component.name,
|
|
72
81
|
url: Decidim::EngineRouter.main_proxy(current_component).root_path,
|
|
73
82
|
active: false,
|
|
74
83
|
resource: current_component
|
|
75
84
|
}
|
|
76
85
|
end
|
|
86
|
+
|
|
87
|
+
def add_parent_breadcrumb_item
|
|
88
|
+
{}
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def add_breadcrumb_item
|
|
92
|
+
{}
|
|
93
|
+
end
|
|
77
94
|
end
|
|
78
95
|
end
|
|
79
96
|
end
|
|
@@ -36,7 +36,7 @@ module Decidim
|
|
|
36
36
|
on(:invalid) do
|
|
37
37
|
flash.now[:alert] = t("passwords.update.error", scope: "decidim")
|
|
38
38
|
resource.errors.errors.concat(@form.errors.errors)
|
|
39
|
-
render action: "edit", status: :
|
|
39
|
+
render action: "edit", status: :unprocessable_content
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -48,7 +48,7 @@ module Decidim
|
|
|
48
48
|
|
|
49
49
|
def redirect_to_referer_or_path
|
|
50
50
|
set_flash_message(:alert, "csrf_token", scope: "devise.failure")
|
|
51
|
-
|
|
51
|
+
redirect_back_or_to(root_path) && return
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def check_sign_in_enabled
|
|
@@ -37,7 +37,7 @@ module Decidim
|
|
|
37
37
|
DownloadYourDataExportJob.perform_later(current_user)
|
|
38
38
|
|
|
39
39
|
flash[:notice] = t("decidim.account.download_your_data_export.notice")
|
|
40
|
-
|
|
40
|
+
redirect_back_or_to(download_your_data_path)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def download_file
|
|
@@ -50,7 +50,7 @@ module Decidim
|
|
|
50
50
|
flash[:error] = t("decidim.account.download_your_data_export.export_expired")
|
|
51
51
|
redirect_to download_your_data_path
|
|
52
52
|
elsif private_export.file.attached?
|
|
53
|
-
redirect_to
|
|
53
|
+
redirect_to Rails.application.routes.url_helpers.rails_blob_url(private_export.file.blob, only_path: true)
|
|
54
54
|
else
|
|
55
55
|
flash[:error] = t("decidim.account.download_your_data_export.file_no_exists")
|
|
56
56
|
redirect_to download_your_data_path
|
|
@@ -16,7 +16,7 @@ module Decidim
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
on(:invalid) do |_message|
|
|
19
|
-
render json: { message: I18n.t("error", scope: "decidim.editor_images.create") }, status: :
|
|
19
|
+
render json: { message: I18n.t("error", scope: "decidim.editor_images.create") }, status: :unprocessable_content
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module Decidim
|
|
4
4
|
class FollowsController < Decidim::ApplicationController
|
|
5
5
|
include FormFactory
|
|
6
|
+
|
|
6
7
|
before_action :authenticate_user!
|
|
7
8
|
helper_method :resource, :button_cell, :button_cell_mobile
|
|
8
9
|
|
|
@@ -16,7 +17,7 @@ module Decidim
|
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
on(:invalid) do
|
|
19
|
-
render json: { error: I18n.t("follows.destroy.error", scope: "decidim") }, status: :
|
|
20
|
+
render json: { error: I18n.t("follows.destroy.error", scope: "decidim") }, status: :unprocessable_content
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
end
|
|
@@ -31,7 +32,7 @@ module Decidim
|
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
on(:invalid) do
|
|
34
|
-
render json: { error: I18n.t("follows.create.error", scope: "decidim") }, status: :
|
|
35
|
+
render json: { error: I18n.t("follows.create.error", scope: "decidim") }, status: :unprocessable_content
|
|
35
36
|
end
|
|
36
37
|
end
|
|
37
38
|
end
|
|
@@ -43,7 +44,7 @@ module Decidim
|
|
|
43
44
|
end
|
|
44
45
|
|
|
45
46
|
def button_options
|
|
46
|
-
params.
|
|
47
|
+
params.expect(follow: [:button_classes]).to_h.symbolize_keys
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
def button_cell_mobile
|
|
@@ -8,7 +8,7 @@ module Decidim
|
|
|
8
8
|
enforce_permission_to :locate, :geolocation
|
|
9
9
|
|
|
10
10
|
unless Decidim::Map.configured?
|
|
11
|
-
return render(json: { message: I18n.t("not_configured", scope: "decidim.application.geocoding"), found: false }, status: :
|
|
11
|
+
return render(json: { message: I18n.t("not_configured", scope: "decidim.application.geocoding"), found: false }, status: :unprocessable_content)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
geocoder = Decidim::Map.utility(:geocoding, organization: current_organization)
|
|
@@ -5,6 +5,7 @@ module Decidim
|
|
|
5
5
|
class LikesController < Decidim::Components::BaseController
|
|
6
6
|
# we need to +include+ to be able to call :like_button from the view
|
|
7
7
|
include Decidim::LikeableHelper
|
|
8
|
+
|
|
8
9
|
helper_method :like_button
|
|
9
10
|
# we need to declare with +helper+ to be able to call :render_like_identity from the views
|
|
10
11
|
helper Decidim::LikeableHelper
|
|
@@ -22,7 +23,7 @@ module Decidim
|
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
on(:invalid) do
|
|
25
|
-
render json: { error: I18n.t("resource_likes.create.error", scope: "decidim") }, status: :
|
|
26
|
+
render json: { error: I18n.t("resource_likes.create.error", scope: "decidim") }, status: :unprocessable_content
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
29
|
end
|
|
@@ -7,20 +7,12 @@ module Decidim
|
|
|
7
7
|
|
|
8
8
|
def create
|
|
9
9
|
enforce_permission_to :create, :locales
|
|
10
|
-
current_user.update!(locale: params["locale"]) if current_user && params["locale"] && available_locales.include?(params["locale"])
|
|
11
|
-
|
|
12
|
-
redirect_to referer_with_new_locale
|
|
13
|
-
end
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
desired_locale = params["locale"] if params["locale"] && available_locales.include?(params["locale"])
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
uri = URI(request.referer || "/")
|
|
19
|
-
query = uri.query.to_s.gsub(/locale=[a-zA-Z-]{2,5}/, "")
|
|
20
|
-
params = URI.decode_www_form(query) << ["locale", current_locale]
|
|
21
|
-
uri.query = URI.encode_www_form(params)
|
|
13
|
+
current_user.update!(locale: params["locale"]) if current_user && params["locale"] && available_locales.include?(params["locale"])
|
|
22
14
|
|
|
23
|
-
|
|
15
|
+
redirect_to canonical_url(request.referer || "/", desired_locale || default_locale)
|
|
24
16
|
end
|
|
25
17
|
end
|
|
26
18
|
end
|