decidim-core 0.29.1 → 0.30.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/activity_cell.rb +0 -3
- data/app/cells/decidim/amendable/amend_button_card/show.erb +6 -4
- data/app/cells/decidim/amendable/amend_button_card_cell.rb +8 -0
- data/app/cells/decidim/amendable/amendments/show.erb +1 -1
- data/app/cells/decidim/amendable/promote_button_card/show.erb +2 -0
- data/app/cells/decidim/author/show.erb +5 -4
- data/app/cells/decidim/author_cell.rb +27 -1
- data/app/cells/decidim/card_l/extra_data.erb +1 -0
- data/app/cells/decidim/card_metadata_cell.rb +9 -16
- data/app/cells/decidim/card_s/show.erb +5 -3
- data/app/cells/decidim/comments_button_cell.rb +14 -2
- data/app/cells/decidim/content_blocks/highlighted_elements_cell.rb +2 -0
- data/app/cells/decidim/content_blocks/highlighted_elements_with_cell_for_list_cell.rb +1 -1
- data/app/cells/decidim/diff_cell.rb +4 -0
- data/app/cells/decidim/endorsement_block/show.erb +0 -1
- data/app/cells/decidim/endorsement_block_cell.rb +6 -0
- data/app/cells/decidim/endorsement_buttons/button_content.erb +1 -1
- data/app/cells/decidim/endorsement_buttons/select_identity_button.erb +1 -1
- data/app/cells/decidim/endorsement_buttons/show.erb +7 -7
- data/app/cells/decidim/endorsement_buttons/verification_modal.erb +4 -2
- data/app/cells/decidim/endorsers_list/empty.erb +3 -0
- data/app/cells/decidim/endorsers_list/full.erb +17 -5
- data/app/cells/decidim/endorsers_list/show.erb +19 -10
- data/app/cells/decidim/endorsers_list_cell.rb +19 -6
- data/app/cells/decidim/follow_button/show.erb +1 -2
- data/app/cells/decidim/follow_button_cell.rb +5 -0
- data/app/cells/decidim/map/show.erb +3 -0
- data/app/cells/decidim/map/template.erb +14 -0
- data/app/cells/decidim/map_cell.rb +39 -0
- data/app/cells/decidim/newsletter_templates/image_text_cta_cell.rb +1 -1
- data/app/cells/decidim/notification_actions/buttons_cell.rb +1 -1
- data/app/cells/decidim/onboarding_action_message/show.erb +15 -0
- data/app/cells/decidim/onboarding_action_message_cell.rb +81 -0
- data/app/cells/decidim/participatory_space_private_user/show.erb +23 -0
- data/app/cells/decidim/participatory_space_private_user_cell.rb +21 -0
- data/app/cells/decidim/progress_bar/show.erb +2 -2
- data/app/cells/decidim/report_button_cell.rb +1 -0
- data/app/cells/decidim/resource_history/show.erb +20 -0
- data/app/cells/decidim/resource_history_cell.rb +66 -0
- data/app/cells/decidim/share_button_cell.rb +0 -4
- data/app/cells/decidim/share_widget/modal.erb +26 -0
- data/app/cells/decidim/share_widget/show.erb +2 -0
- data/app/cells/decidim/share_widget_cell.rb +20 -0
- data/app/cells/decidim/tags/show.erb +7 -4
- data/app/cells/decidim/tags_cell.rb +11 -72
- data/app/cells/decidim/translation_bar/show.erb +2 -2
- data/app/cells/decidim/translation_bar_cell.rb +1 -1
- data/app/commands/decidim/amendable/create_draft.rb +2 -2
- data/app/commands/decidim/create_ephemeral_user.rb +52 -0
- data/app/commands/decidim/create_omniauth_registration.rb +13 -3
- data/app/commands/decidim/create_report.rb +1 -5
- data/app/commands/decidim/create_user_group.rb +6 -2
- data/app/commands/decidim/destroy_account.rb +3 -0
- data/app/commands/decidim/destroy_ephemeral_user.rb +47 -0
- data/app/commands/decidim/update_account.rb +11 -3
- data/app/commands/decidim/update_notifications_settings.rb +1 -0
- data/app/commands/decidim/update_resources_taxonomies.rb +67 -0
- data/app/commands/decidim/update_user_group.rb +7 -1
- data/app/constraints/decidim/current_component.rb +1 -1
- data/app/controllers/concerns/decidim/ajax_permission_handler.rb +21 -0
- data/app/controllers/concerns/decidim/devise_authentication_methods.rb +3 -6
- data/app/controllers/concerns/decidim/devise_controllers.rb +2 -0
- data/app/controllers/concerns/decidim/disable_redirection_to_external_host.rb +1 -1
- data/app/controllers/concerns/decidim/ephemeral_session_checker.rb +87 -0
- data/app/controllers/concerns/decidim/filter_resource.rb +4 -2
- data/app/controllers/concerns/decidim/has_members_page.rb +25 -0
- data/app/controllers/concerns/decidim/headers/browser_feature_permissions.rb +50 -0
- data/app/controllers/concerns/decidim/locale_switcher.rb +2 -2
- data/app/controllers/concerns/decidim/needs_password_change.rb +0 -1
- data/app/controllers/concerns/decidim/needs_permission.rb +2 -1
- data/app/controllers/concerns/decidim/needs_tos_accepted.rb +4 -5
- data/app/controllers/concerns/decidim/onboarding_action_methods.rb +52 -0
- data/app/controllers/decidim/application_controller.rb +10 -0
- data/app/controllers/decidim/authorization_modals_controller.rb +8 -2
- data/app/controllers/decidim/components/base_controller.rb +3 -7
- data/app/controllers/decidim/devise/confirmations_controller.rb +4 -0
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +8 -1
- data/app/controllers/decidim/devise/registrations_controller.rb +1 -1
- data/app/controllers/decidim/devise/sessions_controller.rb +2 -0
- data/app/controllers/decidim/doorkeeper/credentials_controller.rb +1 -1
- data/app/controllers/decidim/download_your_data_controller.rb +33 -2
- data/app/controllers/decidim/editor_images_controller.rb +1 -11
- data/app/controllers/decidim/follows_controller.rb +1 -1
- data/app/controllers/decidim/geolocation_controller.rb +19 -0
- data/app/controllers/decidim/homepage_controller.rb +0 -1
- data/app/controllers/decidim/links_controller.rb +1 -1
- data/app/controllers/decidim/open_data_controller.rb +33 -8
- data/app/controllers/decidim/profiles_controller.rb +4 -0
- data/app/controllers/decidim/user_conversations_controller.rb +1 -11
- data/app/events/decidim/soft_delete_resource_event.rb +15 -0
- data/app/forms/decidim/amendable/form.rb +4 -2
- data/app/forms/decidim/ephemeral_user_form.rb +22 -0
- data/app/forms/decidim/notifications_settings_form.rb +1 -0
- data/app/forms/decidim/omniauth_registration_form.rb +14 -1
- data/app/helpers/concerns/decidim/flash_helper_extensions.rb +17 -2
- data/app/helpers/concerns/decidim/user_role_checker.rb +46 -0
- data/app/helpers/decidim/action_authorization_helper.rb +75 -14
- data/app/helpers/decidim/amendments_helper.rb +0 -9
- data/app/helpers/decidim/application_helper.rb +6 -2
- data/app/helpers/decidim/breadcrumb_helper.rb +6 -0
- data/app/helpers/decidim/cache_helper.rb +1 -1
- data/app/helpers/decidim/check_boxes_tree_helper.rb +25 -53
- data/app/helpers/decidim/cta_button_helper.rb +1 -1
- data/app/helpers/decidim/decidim_form_helper.rb +0 -44
- data/app/helpers/decidim/endorsable_helper.rb +0 -10
- data/app/helpers/decidim/layout_helper.rb +6 -0
- data/app/helpers/decidim/map_helper.rb +6 -1
- data/app/helpers/decidim/messaging/conversation_helper.rb +2 -3
- data/app/helpers/decidim/meta_tags_helper.rb +32 -23
- data/app/helpers/decidim/modal_helper.rb +23 -0
- data/app/helpers/decidim/omniauth_helper.rb +5 -5
- data/app/helpers/decidim/onboarding_action_helper.rb +13 -0
- data/app/helpers/decidim/passwords_helper.rb +2 -2
- data/app/helpers/decidim/sanitize_helper.rb +11 -2
- data/app/helpers/decidim/taxonomies_helper.rb +40 -0
- data/app/jobs/decidim/download_your_data_export_job.rb +2 -19
- data/app/jobs/decidim/event_publisher_job.rb +18 -9
- data/app/jobs/decidim/export_job.rb +5 -1
- data/app/jobs/decidim/export_participatory_space_job.rb +4 -1
- data/app/jobs/decidim/open_data_job.rb +4 -4
- data/app/mailers/decidim/export_mailer.rb +7 -12
- data/app/models/decidim/action_log.rb +11 -0
- data/app/models/decidim/attachment.rb +1 -1
- data/app/models/decidim/category.rb +4 -0
- data/app/models/decidim/component.rb +25 -3
- data/app/models/decidim/metric.rb +2 -1
- data/app/models/decidim/moderation.rb +16 -0
- data/app/models/decidim/newsletter.rb +12 -8
- data/app/models/decidim/organization.rb +7 -3
- data/app/models/decidim/participatory_space_private_user.rb +20 -0
- data/app/models/decidim/private_export.rb +24 -0
- data/app/models/decidim/push_notification_message.rb +1 -1
- data/app/models/decidim/scope.rb +4 -0
- data/app/models/decidim/share_token.rb +36 -10
- data/app/models/decidim/taxonomization.rb +23 -0
- data/app/models/decidim/taxonomy.rb +139 -0
- data/app/models/decidim/taxonomy_filter.rb +130 -0
- data/app/models/decidim/taxonomy_filter_item.rb +33 -0
- data/app/models/decidim/user.rb +9 -23
- data/app/models/decidim/user_base_entity.rb +12 -0
- data/app/models/decidim/user_moderation.rb +9 -0
- data/app/models/decidim/user_report.rb +4 -0
- data/app/packs/entrypoints/decidim_core.js +1 -0
- data/app/packs/entrypoints/decidim_geocoding.js +2 -0
- data/app/packs/images/decidim/brands/facebook.svg +10 -0
- data/app/packs/images/decidim/brands/google.svg +7 -1
- data/app/packs/images/decidim/brands/twitter-x.svg +3 -0
- data/app/packs/src/decidim/append_redirect_url_to_modals.js +14 -6
- data/app/packs/src/decidim/check_boxes_tree.js +0 -1
- data/app/packs/src/decidim/clipboard.js +18 -9
- data/app/packs/src/decidim/confirm.js +79 -59
- data/app/packs/src/decidim/decidim_application.js +1 -0
- data/app/packs/src/decidim/direct_uploads/upload_field.js +21 -8
- data/app/packs/src/decidim/form_remote.js +1 -1
- data/app/packs/src/decidim/geocoding/reverse_geocoding.js +60 -0
- data/app/packs/src/decidim/impersonation.js +1 -1
- data/app/packs/src/decidim/index.js +14 -1
- data/app/packs/src/decidim/onboarding_pending_action.js +24 -0
- data/app/packs/src/decidim/remote_tooltips.js +38 -0
- data/app/packs/src/decidim/session_timeouter.js +1 -1
- data/app/packs/src/decidim/sticky_footer.js +29 -0
- data/app/packs/src/decidim/sticky_header.js +6 -31
- data/app/packs/src/decidim/toggle.js +1 -1
- data/app/packs/src/decidim/tooltips.js +42 -22
- data/app/packs/src/decidim/user_registrations.js +13 -0
- data/app/packs/src/decidim/utilities/dom.js +148 -0
- data/app/packs/stylesheets/decidim/_accordion.scss +30 -0
- data/app/packs/stylesheets/decidim/_buttons.scss +19 -0
- data/app/packs/stylesheets/decidim/_dropdown.scss +1 -1
- data/app/packs/stylesheets/decidim/_endorsers_list.scss +26 -20
- data/app/packs/stylesheets/decidim/_forms.scss +2 -2
- data/app/packs/stylesheets/decidim/_header.scss +5 -3
- data/app/packs/stylesheets/decidim/_labels.scss +1 -1
- data/app/packs/stylesheets/decidim/_layout.scss +32 -2
- data/app/packs/stylesheets/decidim/_login.scss +53 -6
- data/app/packs/stylesheets/decidim/_modal.scss +42 -0
- data/app/packs/stylesheets/decidim/_modal_tos_refuse.scss +4 -0
- data/app/packs/stylesheets/decidim/_participatory_spaces.scss +46 -0
- data/app/packs/stylesheets/decidim/_profile.scss +2 -2
- data/app/packs/stylesheets/decidim/_progress-bar.scss +1 -1
- data/app/packs/stylesheets/decidim/_success_image.scss +64 -0
- data/app/packs/stylesheets/decidim/_tribute.scss +36 -0
- data/app/packs/stylesheets/decidim/application.scss +1 -0
- data/app/packs/stylesheets/decidim/geocoding_addons.scss +5 -0
- data/app/packs/stylesheets/decidim/legacy/conference-diploma.scss +2 -1
- data/app/packs/stylesheets/decidim/map.scss +7 -10
- data/app/packs/stylesheets/decidim/resource_history.scss +31 -0
- data/app/permissions/decidim/permissions.rb +8 -2
- data/app/presenters/decidim/admin_log/base_user_presenter.rb +67 -0
- data/app/presenters/decidim/admin_log/component_presenter.rb +32 -3
- data/app/presenters/decidim/admin_log/moderation_presenter.rb +30 -3
- data/app/presenters/decidim/admin_log/share_token_presenter.rb +39 -0
- data/app/presenters/decidim/admin_log/taxonomy_filter_presenter.rb +57 -0
- data/app/presenters/decidim/admin_log/taxonomy_presenter.rb +48 -0
- data/app/presenters/decidim/admin_log/user_group_presenter.rb +6 -6
- data/app/presenters/decidim/admin_log/user_presenter.rb +4 -18
- data/app/presenters/decidim/attachment_presenter.rb +1 -1
- data/app/presenters/decidim/log/value_types/date_presenter.rb +1 -0
- data/app/presenters/decidim/log/value_types/taxonomy_presenter.rb +29 -0
- data/app/presenters/decidim/participatory_space_private_user_presenter.rb +50 -0
- data/app/presenters/decidim/taxonomy_filter_presenter.rb +19 -0
- data/app/presenters/decidim/taxonomy_presenter.rb +14 -0
- data/app/queries/decidim/metrics/blocked_users_metric_manage.rb +2 -2
- data/app/queries/decidim/metrics/users_metric_manage.rb +2 -2
- data/app/queries/decidim/public_activities.rb +1 -12
- data/app/queries/decidim/stats_users_count.rb +2 -2
- data/app/resolvers/decidim/meta_image_url_resolver.rb +128 -0
- data/app/serializers/decidim/exporters/open_data_blocked_user_serializer.rb +25 -0
- data/app/serializers/decidim/exporters/open_data_metric_serializer.rb +22 -0
- data/app/serializers/decidim/exporters/open_data_moderation_serializer.rb +30 -0
- data/app/serializers/decidim/exporters/open_data_taxonomy_serializer.rb +30 -0
- data/app/serializers/decidim/exporters/open_data_user_group_serializer.rb +38 -0
- data/app/serializers/decidim/exporters/open_data_user_serializer.rb +39 -0
- data/app/serializers/decidim/exporters/participatory_space_serializer.rb +104 -0
- data/app/serializers/decidim/exporters/serializer.rb +25 -0
- data/app/serializers/decidim/schema_org_breadcrumb_list_serializer.rb +52 -0
- data/app/services/decidim/action_authorizer.rb +32 -3
- data/app/services/decidim/base_diff_renderer.rb +27 -3
- data/app/services/decidim/download_your_data_exporter.rb +58 -24
- data/app/services/decidim/email_notification_generator.rb +14 -5
- data/app/services/decidim/onboarding_manager.rb +272 -0
- data/app/services/decidim/open_data_exporter.rb +139 -13
- data/app/services/decidim/traceability.rb +13 -0
- data/app/uploaders/decidim/application_uploader.rb +1 -1
- data/app/validators/etiquette_validator.rb +9 -2
- data/app/validators/passthru_validator.rb +1 -1
- data/app/validators/translated_etiquette_validator.rb +32 -0
- data/app/views/decidim/account/_password_fields.html.erb +2 -2
- data/app/views/decidim/application/_accordion_section.html.erb +14 -0
- data/app/views/decidim/application/_collection.html.erb +30 -18
- data/app/views/decidim/devise/omniauth_registrations/new.html.erb +5 -1
- data/app/views/decidim/devise/omniauth_registrations/new_tos_fields.html.erb +29 -0
- data/app/views/decidim/devise/registrations/new.html.erb +10 -22
- data/app/views/decidim/devise/sessions/new.html.erb +24 -29
- data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +2 -4
- data/app/views/decidim/devise/shared/_tos_fields.html.erb +16 -0
- data/app/views/decidim/download_your_data/_export.html.erb +15 -0
- data/app/views/decidim/download_your_data/show.html.erb +51 -5
- data/app/views/decidim/endorsements/update_buttons_and_counters.js.erb +16 -19
- data/app/views/decidim/export_mailer/download_your_data_export.html.erb +2 -2
- data/app/views/decidim/export_mailer/export.html.erb +5 -1
- data/app/views/decidim/notifications_settings/show.html.erb +22 -0
- data/app/views/decidim/open_data/_how_to_open_accordion_section.html.erb +15 -0
- data/app/views/decidim/open_data/index.html.erb +108 -0
- data/app/views/decidim/pages/_tabbed.html.erb +2 -2
- data/app/views/decidim/pages/show.html.erb +2 -1
- data/app/views/decidim/participatory_space_private_users/_participatory_space_private_user.html.erb +1 -0
- data/app/views/decidim/shared/_login_modal.html.erb +26 -20
- data/app/views/decidim/shared/_resource_actions.html.erb +21 -0
- data/app/views/decidim/shared/filters/_check_boxes_tree.html.erb +1 -2
- data/app/views/decidim/shared/filters/_collection.html.erb +1 -1
- data/app/views/decidim/shared/filters/_dropdown_label.html.erb +7 -4
- data/app/views/layouts/decidim/_application.html.erb +0 -1
- data/app/views/layouts/decidim/_js_configuration.html.erb +1 -0
- data/app/views/layouts/decidim/_logo.html.erb +1 -1
- data/app/views/layouts/decidim/_logo_mobile.html.erb +1 -1
- data/app/views/layouts/decidim/_meta_tags_config.html.erb +6 -11
- data/app/views/layouts/decidim/_schema_org_breadcrumb_list.html.erb +3 -0
- data/app/views/layouts/decidim/_wrapper.html.erb +15 -9
- data/app/views/layouts/decidim/footer/_main_links.html.erb +1 -1
- data/app/views/layouts/decidim/header/_close_ephemeral_session.html.erb +25 -0
- data/app/views/layouts/decidim/header/_main.html.erb +14 -10
- data/app/views/layouts/decidim/header/_menu_breadcrumb_items.html.erb +2 -0
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +1 -1
- data/app/views/layouts/decidim/shared/_layout_item.html.erb +1 -1
- data/config/assets.rb +2 -1
- data/config/locales/ar.yml +38 -54
- data/config/locales/bg.yml +3 -64
- data/config/locales/bn-BD.yml +1 -0
- data/config/locales/bs-BA.yml +98 -0
- data/config/locales/ca.yml +380 -69
- data/config/locales/cs.yml +369 -55
- data/config/locales/de.yml +371 -67
- data/config/locales/el.yml +5 -45
- data/config/locales/en.yml +365 -54
- data/config/locales/eo.yml +0 -2
- data/config/locales/es-MX.yml +366 -58
- data/config/locales/es-PY.yml +366 -58
- data/config/locales/es.yml +375 -64
- data/config/locales/eu.yml +547 -223
- data/config/locales/fi-plain.yml +361 -57
- data/config/locales/fi.yml +400 -93
- data/config/locales/fr-CA.yml +181 -55
- data/config/locales/fr.yml +182 -53
- data/config/locales/ga-IE.yml +4 -16
- data/config/locales/gl.yml +5 -30
- data/config/locales/hu.yml +3 -55
- data/config/locales/id-ID.yml +5 -30
- data/config/locales/is-IS.yml +4 -13
- data/config/locales/it.yml +10 -46
- data/config/locales/ja.yml +230 -69
- data/config/locales/lb.yml +5 -47
- data/config/locales/lt.yml +5 -59
- data/config/locales/lv.yml +5 -36
- data/config/locales/nl.yml +5 -48
- data/config/locales/no.yml +6 -47
- data/config/locales/pl.yml +4 -66
- data/config/locales/pt-BR.yml +12 -52
- data/config/locales/pt.yml +11 -47
- data/config/locales/ro-RO.yml +448 -247
- data/config/locales/ru.yml +4 -16
- data/config/locales/sk.yml +5 -37
- data/config/locales/sv.yml +108 -64
- data/config/locales/tr-TR.yml +5 -45
- data/config/locales/uk.yml +4 -15
- data/config/locales/zh-CN.yml +5 -45
- data/config/locales/zh-TW.yml +5 -50
- data/config/routes.rb +5 -10
- data/db/migrate/20181025082245_add_timestamps_to_components.rb +2 -0
- data/db/migrate/20240628111905_add_visible_to_components.rb +7 -0
- data/db/migrate/20240704115429_create_decidim_taxonomies.rb +23 -0
- data/db/migrate/20240717093514_add_registered_only_to_decidim_share_tokens.rb +7 -0
- data/db/migrate/20240722215500_change_object_changes_on_versions.rb +39 -0
- data/db/migrate/20240806065417_create_decidim_taxonomy_filters.rb +23 -0
- data/db/migrate/20240822161348_add_deleted_at_to_decidim_components.rb +8 -0
- data/db/migrate/20240906162524_add_part_of_to_taxonomies.rb +26 -0
- data/db/migrate/20241001135825_add_role_to_participatory_space_private_users.rb +7 -0
- data/db/migrate/20241001140408_add_published_to_participatory_space_private_users.rb +7 -0
- data/db/migrate/20241022002600_create_private_exports.rb +18 -0
- data/db/migrate/20241028114430_add_component_counter_to_taxonomy_filters.rb +7 -0
- data/db/migrate/20241111104357_add_names_and_space_boolean_to_taxonomy_filters.rb +9 -0
- data/db/migrate/20241127093708_add_taxonomy_to_metrics.rb +7 -0
- data/db/migrate/20241204121445_add_participatory_space_manifests_from_taxonomy_filters.rb +9 -0
- data/decidim-core.gemspec +18 -18
- data/lib/decidim/action_authorization.rb +3 -2
- data/lib/decidim/amendable.rb +1 -1
- data/lib/decidim/api/functions/component_list.rb +1 -1
- data/lib/decidim/api/functions/participatory_space_finder_base.rb +11 -1
- data/lib/decidim/api/input_filters/category_input_filter.rb +5 -3
- data/lib/decidim/api/input_filters/component_input_filter.rb +33 -20
- data/lib/decidim/api/input_filters/user_entity_input_filter.rb +53 -44
- data/lib/decidim/api/input_sorts/component_input_sort.rb +15 -13
- data/lib/decidim/api/input_sorts/user_entity_input_sort.rb +4 -4
- data/lib/decidim/api/interfaces/author_interface.rb +3 -2
- data/lib/decidim/api/interfaces/coauthorable_interface.rb +5 -5
- data/lib/decidim/api/interfaces/endorsable_interface.rb +2 -2
- data/lib/decidim/api/interfaces/participatory_space_interface.rb +5 -10
- data/lib/decidim/api/interfaces/taxonomizable_interface.rb +13 -0
- data/lib/decidim/api/types/amendment_type.rb +5 -7
- data/lib/decidim/api/types/area_api_type.rb +3 -3
- data/lib/decidim/api/types/attachment_type.rb +3 -3
- data/lib/decidim/api/types/category_type.rb +2 -2
- data/lib/decidim/api/types/component_type.rb +7 -0
- data/lib/decidim/api/types/decidim_type.rb +5 -1
- data/lib/decidim/api/types/fingerprint_type.rb +1 -1
- data/lib/decidim/api/types/localized_string_type.rb +1 -1
- data/lib/decidim/api/types/metric_history_type.rb +2 -0
- data/lib/decidim/api/types/metric_type.rb +1 -1
- data/lib/decidim/api/types/organization_type.rb +5 -0
- data/lib/decidim/api/types/participatory_space_link_type.rb +2 -2
- data/lib/decidim/api/types/participatory_space_manifest_type.rb +1 -1
- data/lib/decidim/api/types/quantifiable_translated_field_type.rb +1 -1
- data/lib/decidim/api/types/scope_api_type.rb +2 -3
- data/lib/decidim/api/types/session_type.rb +1 -2
- data/lib/decidim/api/types/taxonomy_type.rb +15 -0
- data/lib/decidim/api/types/trace_version_type.rb +2 -2
- data/lib/decidim/api/types/translated_field_type.rb +3 -5
- data/lib/decidim/api/types/user_group_type.rb +11 -20
- data/lib/decidim/api/types/user_type.rb +9 -18
- data/lib/decidim/asset_router/storage.rb +4 -4
- data/lib/decidim/assets/tailwind/tailwind.config.js.erb +2 -1
- data/lib/decidim/attachment_attributes.rb +1 -1
- data/lib/decidim/attribute_encryptor.rb +1 -1
- data/lib/decidim/attribute_object/nested_validator.rb +1 -1
- data/lib/decidim/attributes/integer_with_units.rb +27 -0
- data/lib/decidim/attributes/rich_text.rb +38 -0
- data/lib/decidim/attributes/time_with_zone.rb +11 -1
- data/lib/decidim/attributes.rb +4 -0
- data/lib/decidim/authorization_form_builder.rb +0 -7
- data/lib/decidim/coauthorable.rb +1 -1
- data/lib/decidim/command.rb +3 -3
- data/lib/decidim/commands/destroy_resource.rb +5 -1
- data/lib/decidim/commands/resource_handler.rb +2 -2
- data/lib/decidim/commands/restore_resource.rb +45 -0
- data/lib/decidim/commands/soft_delete_resource.rb +63 -0
- data/lib/decidim/component_manifest.rb +7 -0
- data/lib/decidim/content_parsers/blob_parser.rb +93 -0
- data/lib/decidim/content_parsers.rb +1 -0
- data/lib/decidim/content_renderers/blob_renderer.rb +90 -0
- data/lib/decidim/content_renderers.rb +1 -0
- data/lib/decidim/core/api.rb +2 -0
- data/lib/decidim/core/engine.rb +50 -8
- data/lib/decidim/core/menu.rb +0 -5
- data/lib/decidim/core/seeds.rb +42 -2
- data/lib/decidim/core/test/factories.rb +133 -2
- data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +85 -0
- data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +408 -40
- data/lib/decidim/core/test/shared_examples/components_controller_hide_shared_examples.rb +11 -0
- data/lib/decidim/core/test/shared_examples/components_controller_reorder_shared_examples.rb +21 -0
- data/lib/decidim/core/test/shared_examples/download_open_data_shared_context.rb +36 -0
- data/lib/decidim/core/test/shared_examples/download_open_data_shared_examples.rb +45 -0
- data/lib/decidim/core/test/shared_examples/download_your_data_shared_examples.rb +17 -0
- data/lib/decidim/core/test/shared_examples/etiquette_validator_examples.rb +25 -0
- data/lib/decidim/core/test/shared_examples/follows_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/has_taxonomies.rb +94 -0
- data/lib/decidim/core/test/shared_examples/manage_share_tokens_examples.rb +237 -0
- data/lib/decidim/core/test/shared_examples/map_examples.rb +2 -0
- data/lib/decidim/core/test/shared_examples/open_data_exporter_examples.rb +102 -0
- data/lib/decidim/core/test/shared_examples/participatory_space_members_page_examples.rb +46 -0
- data/lib/decidim/core/test/shared_examples/participatory_space_search_examples.rb +98 -0
- data/lib/decidim/core/test/shared_examples/permissions.rb +7 -7
- data/lib/decidim/core/test/shared_examples/preview_with_share_token_examples.rb +94 -0
- data/lib/decidim/core/test/shared_examples/reports_examples.rb +9 -5
- data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/resource_search_examples.rb +75 -69
- data/lib/decidim/core/test/shared_examples/searchable_resources_shared_context.rb +1 -1
- data/lib/decidim/core/test/shared_examples/simple_event.rb +33 -19
- data/lib/decidim/core/test/shared_examples/social_share_examples.rb +25 -0
- data/lib/decidim/core/test/shared_examples/softdeleteable_components_examples.rb +173 -0
- data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +54 -8
- data/lib/decidim/core/test/shared_examples/taxonomizable_interface_examples.rb +20 -0
- data/lib/decidim/core/test/shared_examples/taxonomizable_resource_examples.rb +37 -0
- data/lib/decidim/core/test/shared_examples/taxonomy_settings.rb +49 -0
- data/lib/decidim/core/test/shared_examples/translated_event_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/with_endorsable_permissions_examples.rb +1 -1
- data/lib/decidim/core/test.rb +9 -5
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +58 -0
- data/lib/decidim/diffy_extension.rb +18 -0
- data/lib/decidim/download_your_data_serializers/download_your_data_identity_serializer.rb +0 -4
- data/lib/decidim/download_your_data_serializers/download_your_data_participatory_space_private_user_serializer.rb +3 -1
- data/lib/decidim/download_your_data_serializers/download_your_data_report_serializer.rb +2 -1
- data/lib/decidim/download_your_data_serializers/download_your_data_user_serializer.rb +6 -7
- data/lib/decidim/download_your_data_serializers.rb +19 -0
- data/lib/decidim/exporters/csv.rb +6 -0
- data/lib/decidim/exporters/export_manifest.rb +14 -0
- data/lib/decidim/exporters/pdf.rb +26 -22
- data/lib/decidim/filter_form_builder.rb +12 -15
- data/lib/decidim/form_builder.rb +7 -130
- data/lib/decidim/has_category.rb +5 -1
- data/lib/decidim/has_private_users.rb +4 -0
- data/lib/decidim/has_taxonomy_settings.rb +47 -0
- data/lib/decidim/has_upload_validations.rb +1 -1
- data/lib/decidim/legacy_form_builder.rb +118 -0
- data/lib/decidim/maintenance/import_models/application_record.rb +93 -0
- data/lib/decidim/maintenance/import_models/area.rb +82 -0
- data/lib/decidim/maintenance/import_models/area_type.rb +12 -0
- data/lib/decidim/maintenance/import_models/assembly_type.rb +49 -0
- data/lib/decidim/maintenance/import_models/categorization.rb +14 -0
- data/lib/decidim/maintenance/import_models/category.rb +107 -0
- data/lib/decidim/maintenance/import_models/participatory_process_type.rb +21 -0
- data/lib/decidim/maintenance/import_models/scope.rb +163 -0
- data/lib/decidim/maintenance/import_models.rb +19 -0
- data/lib/decidim/maintenance/taxonomy_importer.rb +132 -0
- data/lib/decidim/maintenance/taxonomy_plan.rb +78 -0
- data/lib/decidim/maintenance.rb +12 -0
- data/lib/decidim/map/autocomplete.rb +53 -8
- data/lib/decidim/map/dynamic_map.rb +1 -1
- data/lib/decidim/map/provider/geocoding/here.rb +9 -3
- data/lib/decidim/map.rb +3 -6
- data/lib/decidim/moderation_tools.rb +14 -3
- data/lib/decidim/newsletter_encryptor.rb +1 -1
- data/lib/decidim/paddable.rb +1 -1
- data/lib/decidim/participable.rb +10 -10
- data/lib/decidim/participatory_space_user.rb +14 -0
- data/lib/decidim/private_download_helper.rb +15 -0
- data/lib/decidim/query_extensions.rb +0 -26
- data/lib/decidim/record_encryptor.rb +51 -46
- data/lib/decidim/resourceable.rb +16 -0
- data/lib/decidim/seeds.rb +18 -20
- data/lib/decidim/settings_manifest.rb +36 -1
- data/lib/decidim/soft_deletable.rb +17 -0
- data/lib/decidim/taxonomizable.rb +72 -0
- data/lib/decidim/translatable_attributes.rb +6 -1
- data/lib/decidim/view_model.rb +0 -1
- data/lib/tasks/decidim_download_your_data_tasks.rake +2 -4
- data/lib/tasks/decidim_procfile.rake +6 -0
- data/lib/tasks/decidim_tasks.rake +1 -0
- data/lib/tasks/decidim_taxonomies.rake +155 -0
- data/lib/tasks/upgrade/{decidim_fix_categorization.rake → clean.rake} +52 -19
- data/lib/tasks/upgrade/decidim_active_storage_migration_tasks.rake +1 -1
- data/lib/tasks/upgrade/migrations.rake +91 -0
- metadata +217 -103
- data/app/cells/decidim/amendable/amenders_list/show.erb +0 -0
- data/app/cells/decidim/content_blocks/base/content.erb +0 -0
- data/app/cells/decidim/endorsers_list/full_endorsers_list.erb +0 -3
- data/app/cells/decidim/endorsers_list_button/content.erb +0 -1
- data/app/cells/decidim/endorsers_list_button_cell.rb +0 -15
- data/app/cells/decidim/scopes_picker/scope_picker_prompt.erb +0 -3
- data/app/cells/decidim/scopes_picker/scope_picker_values.erb +0 -5
- data/app/cells/decidim/scopes_picker/show.erb +0 -14
- data/app/cells/decidim/scopes_picker_cell.rb +0 -92
- data/app/commands/decidim/update_user_interests.rb +0 -41
- data/app/controllers/decidim/scopes_controller.rb +0 -84
- data/app/controllers/decidim/user_interests_controller.rb +0 -30
- data/app/forms/decidim/user_interest_scope_form.rb +0 -25
- data/app/forms/decidim/user_interests_form.rb +0 -17
- data/app/helpers/decidim/categories_helper.rb +0 -26
- data/app/helpers/decidim/scopes_helper.rb +0 -105
- data/app/packs/images/decidim/vendor/leaflet/layers-2x.png +0 -0
- data/app/packs/images/decidim/vendor/leaflet/layers.png +0 -0
- data/app/packs/images/decidim/vendor/leaflet/marker-icon-2x.png +0 -0
- data/app/packs/images/decidim/vendor/leaflet/marker-icon.png +0 -0
- data/app/packs/images/decidim/vendor/leaflet/marker-shadow.png +0 -0
- data/app/packs/stylesheets/decidim/legacy/MarkerCluster.Default.scss +0 -67
- data/app/packs/stylesheets/decidim/legacy/MarkerCluster.scss +0 -18
- data/app/packs/stylesheets/decidim/legacy/leaflet.scss +0 -705
- data/app/validators/scope_belongs_to_component_validator.rb +0 -16
- data/app/views/decidim/account/_user_groups.html.erb +0 -0
- data/app/views/decidim/scopes/_scopes_picker_input.html.erb +0 -19
- data/app/views/decidim/scopes/picker.html.erb +0 -53
- data/app/views/decidim/shared/_comments.html.erb +0 -0
- data/app/views/decidim/shared/_share_modal.html.erb +0 -26
- data/app/views/decidim/shared/_tags.html.erb +0 -1
- data/app/views/decidim/user_interests/_areas.html.erb +0 -14
- data/app/views/decidim/user_interests/_scopes.html.erb +0 -22
- data/app/views/decidim/user_interests/show.html.erb +0 -22
- data/config/initializers/foundation_rails_helper.rb +0 -4
- data/lib/decidim/core/test/shared_examples/has_category.rb +0 -38
- data/lib/decidim/core/test/shared_examples/has_scope.rb +0 -11
- data/lib/decidim/core/test/shared_examples/manage_component_share_tokens.rb +0 -83
- data/lib/decidim/core/test/shared_examples/preview_component_with_share_token_examples.rb +0 -49
- data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +0 -93
- data/lib/decidim/seven_zip_wrapper.rb +0 -29
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# A command with all the business logic when an admin batch updates taxonomies on several resources.
|
5
|
+
class UpdateResourcesTaxonomies < Decidim::Command
|
6
|
+
# Public: Initializes the command.
|
7
|
+
#
|
8
|
+
# taxonomy_ids - the taxonomy ids to update
|
9
|
+
# resources - an ApplicationRecord collection of resources to update.
|
10
|
+
def initialize(taxonomy_ids, resources, organization)
|
11
|
+
@organization = organization
|
12
|
+
@taxonomies = Decidim::Taxonomy.non_roots.where(organization:, id: taxonomy_ids)
|
13
|
+
@resources = resources
|
14
|
+
@response = { taxonomies: [], successful: [], errored: [] }
|
15
|
+
end
|
16
|
+
|
17
|
+
# Executes the command. Broadcasts these events:
|
18
|
+
#
|
19
|
+
# - :update_resources_taxonomies - when everything is ok, returns @response.
|
20
|
+
# - :invalid_taxonomies - if the taxonomy is blank.
|
21
|
+
# - :invalid_resources - if the resource_ids is blank.
|
22
|
+
#
|
23
|
+
# Returns @response hash:
|
24
|
+
#
|
25
|
+
# - :taxonomies - Array of the updated taxonomies
|
26
|
+
# - :successful - Array of the updated resources
|
27
|
+
# - :errored - Array of the resources not updated because they already had the taxonomies assigned
|
28
|
+
def call
|
29
|
+
return broadcast(:invalid_taxonomies) if @taxonomies.blank?
|
30
|
+
return broadcast(:invalid_resources) if @resources.blank? || !@resources.respond_to?(:find_each)
|
31
|
+
|
32
|
+
update_resources_taxonomies
|
33
|
+
|
34
|
+
broadcast(:update_resources_taxonomies, @response)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Useful for running any code that you may want to execute before updating taxonomies on each resource.
|
38
|
+
def run_before_hooks(resource); end
|
39
|
+
|
40
|
+
# Useful for running any code that you may want to execute after updating taxonomies on each resource.
|
41
|
+
def run_after_hooks(resource); end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
attr_reader :taxonomies, :resources, :organization
|
46
|
+
|
47
|
+
def update_resources_taxonomies
|
48
|
+
@response[:taxonomies] = taxonomies
|
49
|
+
resources.find_each do |resource|
|
50
|
+
if taxonomies == resource.taxonomies
|
51
|
+
@response[:errored] << resource
|
52
|
+
else
|
53
|
+
update_resource_taxonomies!(resource)
|
54
|
+
@response[:successful] << resource
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def update_resource_taxonomies!(resource)
|
60
|
+
transaction do
|
61
|
+
run_before_hooks(resource)
|
62
|
+
resource.update!(taxonomies:)
|
63
|
+
run_after_hooks(resource)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -22,7 +22,9 @@ module Decidim
|
|
22
22
|
return broadcast(:invalid) if form.invalid?
|
23
23
|
|
24
24
|
was_verified = user_group.verified?
|
25
|
-
|
25
|
+
with_events do
|
26
|
+
update_user_group
|
27
|
+
end
|
26
28
|
notify_admins if was_verified
|
27
29
|
|
28
30
|
broadcast(:ok, user_group)
|
@@ -32,6 +34,10 @@ module Decidim
|
|
32
34
|
|
33
35
|
attr_reader :form, :user_group
|
34
36
|
|
37
|
+
def event_arguments
|
38
|
+
{ resource: user_group }
|
39
|
+
end
|
40
|
+
|
35
41
|
def update_user_group
|
36
42
|
user_group_attributes = attributes
|
37
43
|
user_group_attributes.delete(:avatar) if form.avatar.blank?
|
@@ -33,7 +33,7 @@ module Decidim
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def detect_current_component(params)
|
36
|
-
@participatory_space.components.find do |component|
|
36
|
+
@participatory_space.components.with_deleted.find do |component|
|
37
37
|
params["component_id"] == component.id.to_s && component.manifest_name == @manifest.name.to_s
|
38
38
|
end
|
39
39
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module AjaxPermissionHandler
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
rescue_from Decidim::ActionForbidden, with: :ajax_user_has_no_permission
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def ajax_user_has_no_permission
|
16
|
+
return user_has_no_permission unless request.xhr?
|
17
|
+
|
18
|
+
render json: { message: I18n.t("actions.unauthorized", scope: "decidim.core") }, status: :unprocessable_entity
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -6,6 +6,7 @@ module Decidim
|
|
6
6
|
module DeviseAuthenticationMethods
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
include Decidim::UserBlockedChecker
|
9
|
+
include Decidim::OnboardingActionMethods
|
9
10
|
|
10
11
|
included do
|
11
12
|
def after_sign_in_path_for(user)
|
@@ -13,8 +14,8 @@ module Decidim
|
|
13
14
|
check_user_block_status(user)
|
14
15
|
elsif user.needs_password_update?
|
15
16
|
decidim.change_password_path
|
16
|
-
elsif
|
17
|
-
decidim_verifications.
|
17
|
+
elsif pending_onboarding_action?(user)
|
18
|
+
decidim_verifications.onboarding_pending_authorizations_path
|
18
19
|
else
|
19
20
|
super
|
20
21
|
end
|
@@ -27,10 +28,6 @@ module Decidim
|
|
27
28
|
def pending_redirect?(user)
|
28
29
|
store_location_for(user, stored_location_for(user))
|
29
30
|
end
|
30
|
-
|
31
|
-
def first_login_and_not_authorized?(user)
|
32
|
-
user.is_a?(User) && user.sign_in_count == 1 && current_organization.available_authorizations.any? && user.verifiable?
|
33
|
-
end
|
34
31
|
end
|
35
32
|
end
|
36
33
|
end
|
@@ -22,6 +22,7 @@ module Decidim
|
|
22
22
|
include NeedsSnippets
|
23
23
|
include UserBlockedChecker
|
24
24
|
include ActiveStorage::SetCurrent
|
25
|
+
include Decidim::OnboardingActionMethods
|
25
26
|
|
26
27
|
helper Decidim::TranslationsHelper
|
27
28
|
helper Decidim::MetaTagsHelper
|
@@ -36,6 +37,7 @@ module Decidim
|
|
36
37
|
helper Decidim::SocialShareButtonHelper
|
37
38
|
helper Decidim::SanitizeHelper
|
38
39
|
helper Decidim::ApplicationHelper
|
40
|
+
helper Decidim::OnboardingActionHelper
|
39
41
|
|
40
42
|
layout "layouts/decidim/application"
|
41
43
|
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
|
9
9
|
included do
|
10
10
|
def redirect_back(fallback_location:, allow_other_host: true, **args) # rubocop:disable Lint/UnusedMethodArgument
|
11
|
-
super
|
11
|
+
super(fallback_location:, allow_other_host: Decidim.allow_open_redirects, **args)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module EphemeralSessionChecker
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
before_action :check_ephemeral_user_session, if: :ephemeral_user_signed_in?
|
11
|
+
|
12
|
+
helper_method :onboarding_manager
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def ephemeral_user_signed_in?
|
18
|
+
user_signed_in? && current_user.ephemeral?
|
19
|
+
end
|
20
|
+
|
21
|
+
def onboarding_manager
|
22
|
+
@onboarding_manager ||= Decidim::OnboardingManager.new(current_user)
|
23
|
+
end
|
24
|
+
|
25
|
+
def check_ephemeral_user_session
|
26
|
+
return true unless request.format.html?
|
27
|
+
|
28
|
+
return destroy_ephemeral_session && redirect_to(decidim.root_path) if onboarding_manager.expired?
|
29
|
+
|
30
|
+
if onboarding_manager.valid?
|
31
|
+
authorizations = action_authorized_to(onboarding_manager.action, **onboarding_manager.action_authorized_resources)
|
32
|
+
|
33
|
+
return redirect_to decidim_verifications.onboarding_pending_authorizations_path unless authorizations_permitted_paths?(authorizations, onboarding_manager)
|
34
|
+
|
35
|
+
if authorizations.global_code == :unauthorized
|
36
|
+
flash[:alert] = t("unauthorized", scope: "decidim.core.actions")
|
37
|
+
return destroy_ephemeral_session && redirect_to(decidim.root_path)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
return true
|
42
|
+
end
|
43
|
+
|
44
|
+
def destroy_ephemeral_session
|
45
|
+
Decidim::DestroyEphemeralUser.call(current_user) do
|
46
|
+
on(:ok) do
|
47
|
+
sign_out(current_user)
|
48
|
+
flash[:notice] = t("ephemeral_session_closed", scope: "decidim.devise.sessions.user")
|
49
|
+
end
|
50
|
+
|
51
|
+
on(:invalid) do
|
52
|
+
flash[:alert] = t("account.destroy.error", scope: "decidim")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# This method determines which paths are allowed to the user based on the
|
58
|
+
# onboarding manager data and the associated authorizations. In all cases
|
59
|
+
# the user is allowed to visit the onboarding pending and the terms of
|
60
|
+
# service pages. In addition:
|
61
|
+
# * If the user is pending to complete an authorization is also allowed to
|
62
|
+
# navigate in the pages to complete the authorizations and the
|
63
|
+
# authorizations path to send the request.
|
64
|
+
# * If the user is authorized is also allowed to visit the paths determined
|
65
|
+
# by the onboarding manager after finishing the authorization flow and
|
66
|
+
# the associated component.
|
67
|
+
# The method checks the request path and checks if the path starts with one
|
68
|
+
# of the paths of the allowlist
|
69
|
+
def authorizations_permitted_paths?(authorizations, onboarding_manager)
|
70
|
+
paths_list = if authorizations.user_pending?
|
71
|
+
authorizations.statuses.map(&:current_path).compact.prepend(
|
72
|
+
decidim_verifications.authorizations_path
|
73
|
+
)
|
74
|
+
elsif authorizations.ok?
|
75
|
+
[onboarding_manager.finished_redirect_path, onboarding_manager.component_path].compact
|
76
|
+
else
|
77
|
+
[]
|
78
|
+
end
|
79
|
+
paths_list.prepend(
|
80
|
+
decidim_verifications.onboarding_pending_authorizations_path,
|
81
|
+
decidim.page_path(terms_of_service_page)
|
82
|
+
)
|
83
|
+
|
84
|
+
paths_list.find { |el| /\A#{URI.parse(el).path}/.match?(request.path) }
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -16,11 +16,13 @@ module Decidim
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def method_missing(method_name, *_arguments)
|
19
|
-
|
19
|
+
method = method_name.to_s.gsub(/\[[0-9]+\]$/, "").to_sym
|
20
|
+
@filter.present? && @filter.has_key?(method) ? @filter[method] : super
|
20
21
|
end
|
21
22
|
|
22
23
|
def respond_to_missing?(method_name, include_private = false)
|
23
|
-
|
24
|
+
method = method_name.to_s.gsub(/\[[0-9]+\]$/, "").to_sym
|
25
|
+
(@filter.present? && @filter.has_key?(method)) || super
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module HasMembersPage
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
helper_method :collection
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def can_visit_index?
|
15
|
+
current_user_can_visit_space? && current_participatory_space.members_public_page?
|
16
|
+
end
|
17
|
+
|
18
|
+
def members
|
19
|
+
@members ||= current_participatory_space.participatory_space_private_users.published
|
20
|
+
end
|
21
|
+
|
22
|
+
alias_method :collection, :members
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -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
|
@@ -46,14 +46,14 @@ module Decidim
|
|
46
46
|
#
|
47
47
|
# Returns an Array of Strings.
|
48
48
|
def available_locales
|
49
|
-
@available_locales ||= (current_organization || Decidim).
|
49
|
+
@available_locales ||= (current_organization || Decidim).available_locales
|
50
50
|
end
|
51
51
|
|
52
52
|
# The default locale of this organization.
|
53
53
|
#
|
54
54
|
# Returns a String with the default locale.
|
55
55
|
def default_locale
|
56
|
-
@default_locale ||= (current_organization || Decidim).
|
56
|
+
@default_locale ||= (current_organization || Decidim).default_locale
|
57
57
|
end
|
58
58
|
|
59
59
|
# Detects the locale priority: query string, user saved, session, browser
|
@@ -28,7 +28,6 @@ module Decidim
|
|
28
28
|
decidim.accept_tos_path,
|
29
29
|
decidim.download_your_data_path,
|
30
30
|
decidim.export_download_your_data_path,
|
31
|
-
decidim.download_file_download_your_data_path,
|
32
31
|
decidim.change_password_path].compact
|
33
32
|
# ensure that path with or without query string pass
|
34
33
|
permitted_paths.find { |el| el.split("?").first == target_path }
|
@@ -40,7 +40,8 @@ module Decidim
|
|
40
40
|
current_settings: try(:current_settings),
|
41
41
|
component_settings: try(:component_settings),
|
42
42
|
current_organization: try(:current_organization),
|
43
|
-
current_component: try(:current_component)
|
43
|
+
current_component: try(:current_component),
|
44
|
+
share_token: try(:store_share_token)
|
44
45
|
}
|
45
46
|
end
|
46
47
|
|
@@ -15,7 +15,7 @@ module Decidim
|
|
15
15
|
def tos_accepted_by_user
|
16
16
|
return true unless request.format.html?
|
17
17
|
return true unless current_user
|
18
|
-
return if current_user.tos_accepted?
|
18
|
+
return if current_user.tos_accepted? || current_user.ephemeral?
|
19
19
|
return if permitted_paths?
|
20
20
|
|
21
21
|
redirect_to_tos
|
@@ -33,12 +33,11 @@ module Decidim
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def permitted_paths?
|
36
|
+
return true if request.path.starts_with?(decidim.download_your_data_path)
|
37
|
+
|
36
38
|
permitted_paths = [tos_path,
|
37
39
|
decidim.delete_account_path,
|
38
|
-
decidim.accept_tos_path
|
39
|
-
decidim.download_your_data_path,
|
40
|
-
decidim.export_download_your_data_path,
|
41
|
-
decidim.download_file_download_your_data_path]
|
40
|
+
decidim.accept_tos_path]
|
42
41
|
# ensure that path with or without query string pass
|
43
42
|
permitted_paths.find { |el| el.split("?").first == request.path }
|
44
43
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module OnboardingActionMethods
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
helper_method :pending_onboarding_action?
|
11
|
+
|
12
|
+
# Returns true if there is a pending onboarding action for the user.
|
13
|
+
# The check if skipped for admins, users that are not verifiable of
|
14
|
+
# organizations that have no available authorizations.
|
15
|
+
def pending_onboarding_action?(user)
|
16
|
+
return false if user.blank?
|
17
|
+
return false if user.admin?
|
18
|
+
return false unless user.verifiable?
|
19
|
+
return false if current_organization.available_authorizations.empty?
|
20
|
+
|
21
|
+
OnboardingManager.new(user).pending_action?
|
22
|
+
end
|
23
|
+
|
24
|
+
def store_onboarding_cookie_data!(user)
|
25
|
+
data = onboarding_cookie_data
|
26
|
+
return if data.nil?
|
27
|
+
|
28
|
+
if data.present?
|
29
|
+
user.extended_data = user.extended_data.merge(data)
|
30
|
+
user.save!
|
31
|
+
end
|
32
|
+
cookies.delete(OnboardingManager::DATA_KEY)
|
33
|
+
end
|
34
|
+
|
35
|
+
def onboarding_cookie_data
|
36
|
+
data_key = OnboardingManager::DATA_KEY
|
37
|
+
return unless cookies[data_key]
|
38
|
+
|
39
|
+
{ data_key => JSON.parse(cookies[data_key]).transform_keys(&:underscore) }
|
40
|
+
rescue JSON::ParserError
|
41
|
+
{}
|
42
|
+
end
|
43
|
+
|
44
|
+
def clear_onboarding_data!(user)
|
45
|
+
return if user.ephemeral?
|
46
|
+
|
47
|
+
user.extended_data = user.extended_data.except(OnboardingManager::DATA_KEY)
|
48
|
+
user.save!
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -16,6 +16,7 @@ module Decidim
|
|
16
16
|
include NeedsTosAccepted
|
17
17
|
include Headers::HttpCachingDisabler
|
18
18
|
include Headers::ContentSecurityPolicy
|
19
|
+
include Headers::BrowserFeaturePermissions
|
19
20
|
include ActionAuthorization
|
20
21
|
include ForceAuthentication
|
21
22
|
include SafeRedirect
|
@@ -25,6 +26,8 @@ module Decidim
|
|
25
26
|
include NeedsPasswordChange
|
26
27
|
include LinkedResourceReference
|
27
28
|
include ActiveStorage::SetCurrent
|
29
|
+
include OnboardingActionMethods
|
30
|
+
include EphemeralSessionChecker
|
28
31
|
|
29
32
|
helper Decidim::MetaTagsHelper
|
30
33
|
helper Decidim::DecidimFormHelper
|
@@ -41,6 +44,7 @@ module Decidim
|
|
41
44
|
helper Decidim::TwitterSearchHelper
|
42
45
|
helper Decidim::SocialShareButtonHelper
|
43
46
|
helper Decidim::FiltersHelper
|
47
|
+
helper Decidim::OnboardingActionHelper
|
44
48
|
|
45
49
|
register_permissions(::Decidim::ApplicationController,
|
46
50
|
::Decidim::Admin::Permissions,
|
@@ -56,6 +60,12 @@ module Decidim
|
|
56
60
|
|
57
61
|
skip_before_action :disable_http_caching, unless: :user_signed_in?
|
58
62
|
|
63
|
+
def store_share_token
|
64
|
+
session[:share_token] = params[:share_token] if params.has_key?(:share_token)
|
65
|
+
|
66
|
+
session[:share_token].presence
|
67
|
+
end
|
68
|
+
|
59
69
|
private
|
60
70
|
|
61
71
|
# This overrides Devise's method for extracting the path from the URL. We
|
@@ -5,10 +5,12 @@ module Decidim
|
|
5
5
|
helper_method :authorizations, :authorize_action_path
|
6
6
|
layout false
|
7
7
|
|
8
|
-
def show
|
8
|
+
def show
|
9
|
+
store_onboarding_cookie_data!(current_user)
|
10
|
+
end
|
9
11
|
|
10
12
|
def authorize_action_path(handler_name)
|
11
|
-
authorizations.status_for(handler_name).current_path(redirect_url:
|
13
|
+
authorizations.status_for(handler_name).current_path(redirect_url:)
|
12
14
|
end
|
13
15
|
|
14
16
|
private
|
@@ -31,5 +33,9 @@ module Decidim
|
|
31
33
|
def authorizations
|
32
34
|
@authorizations ||= action_authorized_to(authorization_action, resource:)
|
33
35
|
end
|
36
|
+
|
37
|
+
def redirect_url
|
38
|
+
pending_onboarding_action?(current_user) ? decidim_verifications.onboarding_pending_authorizations_path : URI(request.referer).path
|
39
|
+
end
|
34
40
|
end
|
35
41
|
end
|
@@ -19,7 +19,7 @@ module Decidim
|
|
19
19
|
helper Decidim::TranslationsHelper
|
20
20
|
helper Decidim::IconHelper
|
21
21
|
helper Decidim::ResourceHelper
|
22
|
-
helper Decidim::
|
22
|
+
helper Decidim::TaxonomiesHelper
|
23
23
|
helper Decidim::ActionAuthorizationHelper
|
24
24
|
helper Decidim::AttachmentsHelper
|
25
25
|
helper Decidim::SanitizeHelper
|
@@ -30,7 +30,7 @@ module Decidim
|
|
30
30
|
:current_manifest
|
31
31
|
|
32
32
|
before_action do
|
33
|
-
enforce_permission_to :read, :component, component: current_component
|
33
|
+
enforce_permission_to :read, :component, component: current_component
|
34
34
|
end
|
35
35
|
|
36
36
|
before_action :redirect_unless_feature_private
|
@@ -49,10 +49,6 @@ module Decidim
|
|
49
49
|
@current_manifest ||= current_component.manifest
|
50
50
|
end
|
51
51
|
|
52
|
-
def share_token
|
53
|
-
params[:share_token]
|
54
|
-
end
|
55
|
-
|
56
52
|
def permission_scope
|
57
53
|
:public
|
58
54
|
end
|
@@ -73,7 +69,7 @@ module Decidim
|
|
73
69
|
def set_component_breadcrumb_item
|
74
70
|
context_breadcrumb_items << {
|
75
71
|
label: current_component.name,
|
76
|
-
url: root_path,
|
72
|
+
url: Decidim::EngineRouter.main_proxy(current_component).root_path,
|
77
73
|
active: false,
|
78
74
|
resource: current_component
|
79
75
|
}
|
@@ -5,6 +5,7 @@ module Decidim
|
|
5
5
|
# Custom Devise ConfirmationsController to avoid namespace problems.
|
6
6
|
class ConfirmationsController < ::Devise::ConfirmationsController
|
7
7
|
include Decidim::DeviseControllers
|
8
|
+
include Decidim::OnboardingActionMethods
|
8
9
|
|
9
10
|
helper_method :new_user_group_session_path
|
10
11
|
|
@@ -33,6 +34,9 @@ module Decidim
|
|
33
34
|
|
34
35
|
sign_in(resource)
|
35
36
|
|
37
|
+
store_onboarding_cookie_data!(resource)
|
38
|
+
return decidim_verifications.onboarding_pending_authorizations_path if pending_onboarding_action?(resource)
|
39
|
+
|
36
40
|
super
|
37
41
|
end
|
38
42
|
end
|
@@ -7,6 +7,7 @@ module Decidim
|
|
7
7
|
include FormFactory
|
8
8
|
include Decidim::DeviseControllers
|
9
9
|
include Decidim::DeviseAuthenticationMethods
|
10
|
+
include NeedsTosAccepted
|
10
11
|
|
11
12
|
def new
|
12
13
|
@form = form(OmniauthRegistrationForm).from_params(params[:user])
|
@@ -36,6 +37,12 @@ module Decidim
|
|
36
37
|
render :new
|
37
38
|
end
|
38
39
|
|
40
|
+
on(:add_tos_errors) do
|
41
|
+
set_flash_message :alert, :add_tos_errors if @form.valid_tos?
|
42
|
+
session[:verified_email] = verified_email
|
43
|
+
render :new_tos_fields
|
44
|
+
end
|
45
|
+
|
39
46
|
on(:error) do |user|
|
40
47
|
if user.errors[:email]
|
41
48
|
set_flash_message :alert, :failure, kind: @form.provider.capitalize, reason: t("decidim.devise.omniauth_registrations.create.email_already_exists")
|
@@ -75,7 +82,7 @@ module Decidim
|
|
75
82
|
end
|
76
83
|
|
77
84
|
def verified_email
|
78
|
-
@verified_email ||= oauth_data.dig(:info, :email)
|
85
|
+
@verified_email ||= oauth_data.dig(:info, :email).presence || session[:verified_email]
|
79
86
|
end
|
80
87
|
|
81
88
|
def oauth_hash
|
@@ -24,6 +24,8 @@ module Decidim
|
|
24
24
|
validator = PasswordValidator.new({ attributes: :password })
|
25
25
|
user.update!(password_updated_at: nil) unless validator.validate_each(user, :password, sign_in_params[:password])
|
26
26
|
end
|
27
|
+
|
28
|
+
store_onboarding_cookie_data!(user)
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
@@ -28,7 +28,7 @@ module Decidim
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def avatar_url
|
31
|
-
avatar_url = current_resource_owner.attached_uploader(:avatar).url
|
31
|
+
avatar_url = current_resource_owner.attached_uploader(:avatar).url
|
32
32
|
return unless avatar_url
|
33
33
|
|
34
34
|
unless %r{^https?://}.match? avatar_url
|