decidim-core 0.26.2 → 0.27.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 +1 -1
- data/app/cells/decidim/amendable/announcement_cell.rb +3 -8
- data/app/cells/decidim/announcement_cell.rb +1 -1
- data/app/cells/decidim/author_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/footer_sub_hero/show.erb +1 -1
- data/app/cells/decidim/content_blocks/hero/show.erb +1 -1
- data/app/cells/decidim/content_blocks/highlighted_content_banner/show.erb +3 -3
- data/app/cells/decidim/content_blocks/highlighted_elements_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/how_to_participate/show.erb +1 -1
- data/app/cells/decidim/content_blocks/last_activity/show.erb +1 -1
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +3 -3
- data/app/cells/decidim/content_blocks/stats_cell.rb +4 -4
- data/app/cells/decidim/content_blocks/sub_hero/show.erb +1 -1
- data/app/cells/decidim/data_consent/category.erb +64 -0
- data/app/cells/decidim/data_consent/dialog.erb +29 -0
- data/app/cells/decidim/data_consent/modal.erb +39 -0
- data/app/cells/decidim/data_consent/show.erb +3 -0
- data/app/cells/decidim/data_consent_cell.rb +21 -0
- data/app/cells/decidim/follow_button_cell.rb +5 -7
- data/app/cells/decidim/profile_sidebar_cell.rb +1 -1
- data/app/cells/decidim/search_results_cell.rb +1 -1
- data/app/cells/decidim/tos_page/refuse_btn_modal.erb +1 -1
- data/app/cells/decidim/upload_modal/files.erb +52 -0
- data/app/cells/decidim/upload_modal/modal.erb +49 -0
- data/app/cells/decidim/upload_modal/show.erb +3 -0
- data/app/cells/decidim/upload_modal_cell.rb +205 -0
- data/app/cells/decidim/user_conversation/reply.erb +1 -1
- data/app/cells/decidim/user_conversations/add_conversation_users.erb +5 -3
- data/app/cells/decidim/version_cell.rb +2 -13
- data/app/cells/decidim/versions_list_cell.rb +2 -13
- data/app/cells/decidim/versions_list_item_cell.rb +2 -13
- data/app/commands/decidim/accept_group_invitation.rb +1 -1
- data/app/commands/decidim/accept_user_group_join_request.rb +1 -1
- data/app/commands/decidim/amendable/accept.rb +1 -1
- data/app/commands/decidim/amendable/create_draft.rb +1 -1
- data/app/commands/decidim/amendable/destroy_draft.rb +1 -1
- data/app/commands/decidim/amendable/promote.rb +1 -1
- data/app/commands/decidim/amendable/publish_draft.rb +1 -1
- data/app/commands/decidim/amendable/reject.rb +1 -1
- data/app/commands/decidim/amendable/update_draft.rb +1 -1
- data/app/commands/decidim/amendable/withdraw.rb +1 -1
- data/app/commands/decidim/attachment_methods.rb +3 -2
- data/app/commands/decidim/create_editor_image.rb +1 -1
- data/app/commands/decidim/create_follow.rb +1 -1
- data/app/commands/decidim/create_omniauth_registration.rb +2 -3
- data/app/commands/decidim/create_registration.rb +1 -2
- data/app/commands/decidim/create_report.rb +1 -1
- data/app/commands/decidim/create_user_group.rb +2 -2
- data/app/commands/decidim/create_user_report.rb +5 -3
- data/app/commands/decidim/delete_follow.rb +1 -1
- data/app/commands/decidim/demote_membership.rb +1 -1
- data/app/commands/decidim/destroy_account.rb +1 -1
- data/app/commands/decidim/endorse_resource.rb +1 -1
- data/app/commands/decidim/gallery_methods.rb +45 -10
- data/app/commands/decidim/invite_user.rb +1 -3
- data/app/commands/decidim/invite_user_again.rb +1 -1
- data/app/commands/decidim/invite_user_to_group.rb +1 -1
- data/app/commands/decidim/join_user_group.rb +1 -1
- data/app/commands/decidim/leave_user_group.rb +8 -2
- data/app/commands/decidim/messaging/reply_to_conversation.rb +2 -2
- data/app/commands/decidim/messaging/start_conversation.rb +2 -2
- data/app/commands/decidim/multiple_attachments_methods.rb +44 -5
- data/app/commands/decidim/promote_membership.rb +1 -1
- data/app/commands/decidim/reject_group_invitation.rb +1 -1
- data/app/commands/decidim/reject_user_group_join_request.rb +1 -1
- data/app/commands/decidim/remove_user_from_group.rb +1 -1
- data/app/commands/decidim/resend_confirmation_instructions.rb +18 -0
- data/app/commands/decidim/search.rb +10 -9
- data/app/commands/decidim/unendorse_resource.rb +1 -1
- data/app/commands/decidim/unsubscribe_settings.rb +1 -1
- data/app/commands/decidim/update_account.rb +2 -2
- data/app/commands/decidim/update_notifications_settings.rb +3 -2
- data/app/commands/decidim/update_password.rb +31 -0
- data/app/commands/decidim/update_user_group.rb +2 -2
- data/app/commands/decidim/update_user_interests.rb +1 -1
- data/app/commands/decidim/validate_upload.rb +15 -0
- data/app/controllers/concerns/decidim/devise_controllers.rb +0 -1
- data/app/controllers/concerns/decidim/filter_resource.rb +23 -24
- data/app/controllers/concerns/decidim/force_authentication.rb +1 -2
- data/app/controllers/concerns/decidim/http_caching_disabler.rb +1 -1
- data/app/controllers/concerns/decidim/needs_password_change.rb +43 -0
- data/app/controllers/concerns/decidim/needs_tos_accepted.rb +3 -3
- data/app/controllers/concerns/decidim/orderable.rb +1 -1
- data/app/controllers/concerns/decidim/participatory_space_context.rb +2 -2
- data/app/controllers/decidim/account_controller.rb +45 -0
- data/app/controllers/decidim/application_controller.rb +1 -1
- data/app/controllers/decidim/devise/invitations_controller.rb +2 -0
- data/app/controllers/decidim/devise/passwords_controller.rb +33 -0
- data/app/controllers/decidim/devise/registrations_controller.rb +2 -0
- data/app/controllers/decidim/devise/sessions_controller.rb +2 -0
- data/app/controllers/decidim/{data_portability_controller.rb → download_your_data_controller.rb} +8 -8
- data/app/controllers/decidim/groups_controller.rb +5 -0
- data/app/controllers/decidim/last_activities_controller.rb +7 -9
- data/app/controllers/decidim/manifests_controller.rb +11 -0
- data/app/controllers/decidim/newsletters_controller.rb +1 -1
- data/app/controllers/decidim/notifications_subscriptions_controller.rb +16 -0
- data/app/controllers/decidim/offline_controller.rb +7 -0
- data/app/controllers/decidim/profiles_controller.rb +1 -1
- data/app/controllers/decidim/searches_controller.rb +4 -3
- data/app/controllers/decidim/short_links_controller.rb +35 -0
- data/app/controllers/decidim/upload_validations_controller.rb +44 -0
- data/app/controllers/decidim/user_activities_controller.rb +32 -16
- data/app/controllers/decidim/user_interests_controller.rb +0 -2
- data/app/controllers/decidim/user_timeline_controller.rb +6 -8
- data/app/events/decidim/change_nickname_event.rb +21 -0
- data/app/forms/decidim/account_form.rb +7 -6
- data/app/forms/decidim/form.rb +1 -1
- data/app/forms/decidim/messaging/conversation_form.rb +1 -1
- data/app/forms/decidim/notifications_settings_form.rb +8 -2
- data/app/forms/decidim/password_form.rb +10 -0
- data/app/forms/decidim/registration_form.rb +10 -4
- data/app/forms/decidim/upload_validation_form.rb +54 -0
- data/app/forms/decidim/user_group_form.rb +1 -1
- data/app/forms/decidim/user_interest_scope_form.rb +1 -1
- data/app/forms/decidim/user_interests_form.rb +1 -1
- data/app/forms/translatable_presence_validator.rb +2 -2
- data/app/forms/url_validator.rb +1 -1
- data/app/helpers/decidim/application_helper.rb +2 -2
- data/app/helpers/decidim/attachments_helper.rb +1 -1
- data/app/helpers/decidim/cells_paginate_helper.rb +1 -1
- data/app/helpers/decidim/datalist_select_helper.rb +40 -0
- data/app/helpers/decidim/decidim_form_helper.rb +1 -1
- data/app/helpers/decidim/followable_helper.rb +1 -1
- data/app/helpers/decidim/icon_helper.rb +1 -1
- data/app/helpers/decidim/layout_helper.rb +15 -1
- data/app/helpers/decidim/map_helper.rb +12 -8
- data/app/helpers/decidim/meta_tags_helper.rb +0 -2
- data/app/helpers/decidim/notifications_settings_helper.rb +15 -0
- data/app/helpers/decidim/passwords_helper.rb +41 -0
- data/app/helpers/decidim/sanitize_helper.rb +1 -0
- data/app/helpers/decidim/searches_helper.rb +6 -6
- data/app/helpers/decidim/short_link_helper.rb +28 -0
- data/app/helpers/decidim/translations_helper.rb +2 -2
- data/app/jobs/decidim/{data_portability_export_job.rb → download_your_data_export_job.rb} +5 -5
- data/app/jobs/decidim/email_notifications_digest_generator_job.rb +21 -0
- data/app/jobs/decidim/notification_generator_for_recipient_job.rb +5 -3
- data/app/jobs/decidim/reminder_generator_job.rb +12 -0
- data/app/jobs/decidim/resend_confirmation_instructions_job.rb +11 -0
- data/app/jobs/decidim/user_report_job.rb +2 -2
- data/app/mailers/concerns/decidim/multitenant_asset_host.rb +11 -3
- data/app/mailers/decidim/application_mailer.rb +1 -1
- data/app/mailers/decidim/block_user_mailer.rb +8 -7
- data/app/mailers/decidim/export_mailer.rb +2 -2
- data/app/mailers/decidim/newsletter_mailer.rb +2 -2
- data/app/mailers/decidim/newsletters_opt_in_mailer.rb +7 -5
- data/app/mailers/decidim/notifications_digest_mailer.rb +23 -0
- data/app/mailers/decidim/user_report_mailer.rb +10 -11
- data/app/models/decidim/action_log.rb +86 -2
- data/app/models/decidim/amendment.rb +0 -1
- data/app/models/decidim/area.rb +1 -2
- data/app/models/decidim/area_type.rb +5 -0
- data/app/models/decidim/attachment.rb +6 -0
- data/app/models/decidim/attachment_collection.rb +5 -0
- data/app/models/decidim/category.rb +9 -4
- data/app/models/decidim/coauthorship.rb +0 -2
- data/app/models/decidim/contextual_help_section.rb +5 -1
- data/app/models/decidim/follow.rb +2 -2
- data/app/models/decidim/gamification/badge_score.rb +0 -1
- data/app/models/decidim/identity.rb +2 -2
- data/app/models/decidim/messaging/conversation.rb +4 -4
- data/app/models/decidim/messaging/message.rb +1 -2
- data/app/models/decidim/messaging/participation.rb +0 -2
- data/app/models/decidim/messaging/receipt.rb +0 -2
- data/app/models/decidim/notification.rb +5 -2
- data/app/models/decidim/oauth_application.rb +12 -1
- data/app/models/decidim/organization.rb +7 -7
- data/app/models/decidim/participatory_space_private_user.rb +4 -2
- data/app/models/decidim/permission_action.rb +1 -0
- data/app/models/decidim/reminder.rb +10 -0
- data/app/models/decidim/reminder_delivery.rb +7 -0
- data/app/models/decidim/reminder_record.rb +29 -0
- data/app/models/decidim/report.rb +2 -2
- data/app/models/decidim/scope.rb +3 -4
- data/app/models/decidim/scope_type.rb +5 -0
- data/app/models/decidim/share_token.rb +0 -2
- data/app/models/decidim/short_link.rb +162 -0
- data/app/models/decidim/user.rb +34 -6
- data/app/models/decidim/user_base_entity.rb +1 -1
- data/app/models/decidim/user_group.rb +3 -3
- data/app/models/decidim/user_moderation.rb +0 -2
- data/app/models/decidim/user_report.rb +2 -2
- data/app/packs/entrypoints/decidim_core.js +2 -2
- data/app/packs/entrypoints/decidim_sw.js +1 -0
- data/app/packs/src/decidim/autocomplete.js +298 -0
- data/app/packs/src/decidim/cookie_consent/consent_manager.js +133 -0
- data/app/packs/src/decidim/cookie_consent/cookie_consent.js +103 -0
- data/app/packs/src/decidim/datalist_select.js +36 -0
- data/app/packs/src/decidim/direct_uploads/upload_field.js +117 -0
- data/app/packs/src/decidim/direct_uploads/upload_modal.js +264 -0
- data/app/packs/src/decidim/direct_uploads/upload_utility.js +49 -0
- data/app/packs/src/decidim/direct_uploads/uploader.js +89 -0
- data/app/packs/src/decidim/external_domain_warning.js +1 -1
- data/app/packs/src/decidim/external_link.js +14 -3
- data/app/packs/src/decidim/external_link.test.js +64 -0
- data/app/packs/src/decidim/geocoding.js +10 -35
- data/app/packs/src/decidim/identity_selector_dialog.js +1 -1
- data/app/packs/src/decidim/impersonation.js +3 -3
- data/app/packs/src/decidim/input_character_counter.js +177 -7
- data/app/packs/src/decidim/input_multiple_mentions.js +87 -187
- data/app/packs/src/decidim/map/factory.js +3 -1
- data/app/packs/src/decidim/map/icon.js +2 -1
- data/app/packs/src/decidim/map/legacy.js +2 -2
- data/app/packs/src/decidim/map/svg-icon.js +248 -0
- data/app/packs/src/decidim/map.js +2 -2
- data/app/packs/src/decidim/security/selfxss_warning.js +5 -1
- data/app/packs/src/decidim/session_timeouter.js +15 -15
- data/app/packs/src/decidim/sw/a2hs.js +28 -0
- data/app/packs/src/decidim/sw/index.js +3 -0
- data/app/packs/src/decidim/sw/loader.js +18 -0
- data/app/packs/src/decidim/sw/push-permissions.js +87 -0
- data/app/packs/src/decidim/sw/sw.js +80 -0
- data/app/packs/src/decidim/vizzs/areachart.js +33 -28
- data/app/packs/src/decidim/vizzs/{metrics.js → index.js} +0 -0
- data/app/packs/src/decidim/vizzs/linechart.js +23 -18
- data/app/packs/src/decidim/vizzs/rowchart.js +15 -11
- data/app/packs/stylesheets/decidim/email.scss +66 -0
- data/app/packs/stylesheets/decidim/layouts/_user.scss +8 -0
- data/app/packs/stylesheets/decidim/modules/_autocomplete.scss +99 -0
- data/app/packs/stylesheets/decidim/modules/_cookie-consent.scss +115 -0
- data/app/packs/stylesheets/decidim/modules/_footer.scss +4 -0
- data/app/packs/stylesheets/decidim/modules/_input-multiple-mentions.scss +29 -2
- data/app/packs/stylesheets/decidim/modules/_modules.scss +3 -1
- data/app/packs/stylesheets/decidim/modules/_reveal.scss +15 -0
- data/app/packs/stylesheets/decidim/modules/_upload_modal.scss +143 -0
- data/app/packs/stylesheets/decidim/utils/_fontface.scss +3 -0
- data/app/permissions/decidim/permissions.rb +2 -4
- data/app/presenters/decidim/admin_log/area_type_presenter.rb +34 -0
- data/app/presenters/decidim/admin_log/attachment_collection_presenter.rb +35 -0
- data/app/presenters/decidim/admin_log/attachment_presenter.rb +27 -0
- data/app/presenters/decidim/admin_log/category_presenter.rb +36 -0
- data/app/presenters/decidim/admin_log/component_presenter.rb +35 -3
- data/app/presenters/decidim/admin_log/contextual_help_section_presenter.rb +33 -0
- data/app/presenters/decidim/admin_log/organization_presenter.rb +9 -4
- data/app/presenters/decidim/admin_log/scope_type_presenter.rb +34 -0
- data/app/presenters/decidim/home_stats_presenter.rb +4 -2
- data/app/presenters/decidim/log/base_presenter.rb +1 -1
- data/app/presenters/decidim/menu_item_presenter.rb +1 -1
- data/app/presenters/decidim/metric_charts_presenter.rb +7 -1
- data/app/presenters/decidim/nil_presenter.rb +3 -1
- data/app/presenters/decidim/notification_to_mailer_presenter.rb +39 -0
- data/app/presenters/decidim/notifications_digest_presenter.rb +42 -0
- data/app/presenters/decidim/official_author_presenter.rb +4 -0
- data/app/presenters/decidim/organization_presenter.rb +22 -0
- data/app/presenters/decidim/push_notification_presenter.rb +24 -0
- data/app/presenters/decidim/stats_presenter.rb +1 -1
- data/app/presenters/decidim/validation_errors_presenter.rb +1 -1
- data/app/queries/decidim/messaging/user_conversations.rb +1 -1
- data/app/queries/decidim/metric_manage.rb +1 -1
- data/app/queries/decidim/own_activities.rb +11 -0
- data/app/queries/decidim/participatory_processes_with_user_role.rb +1 -1
- data/app/{services/decidim/activity_search.rb → queries/decidim/public_activities.rb} +35 -77
- data/app/queries/decidim/public_components.rb +1 -1
- data/app/queries/decidim/similar_emendations.rb +1 -1
- data/app/queries/decidim/stats_users_count.rb +1 -1
- data/app/queries/decidim/user_groups/accepted_memberships.rb +1 -1
- data/app/queries/decidim/user_groups/accepted_user_groups.rb +1 -1
- data/app/queries/decidim/user_groups/accepted_users.rb +1 -1
- data/app/queries/decidim/user_groups/admin_memberships.rb +1 -1
- data/app/queries/decidim/user_groups/invited_memberships.rb +1 -1
- data/app/queries/decidim/user_groups/manageable_user_groups.rb +1 -1
- data/app/queries/decidim/user_groups/member_memberships.rb +1 -1
- data/app/services/decidim/{data_portability_exporter.rb → download_your_data_exporter.rb} +6 -6
- data/app/services/decidim/email_notification_generator.rb +2 -2
- data/app/services/decidim/engine_resolver.rb +66 -0
- data/app/services/decidim/events_manager.rb +1 -1
- data/app/services/decidim/iframe_disabler.rb +31 -0
- data/app/services/decidim/notification_generator_for_recipient.rb +1 -1
- data/app/services/decidim/notifications_digest_sending_decider.rb +18 -0
- data/app/services/decidim/notifications_subscriptions_persistor.rb +37 -0
- data/app/services/decidim/open_data_exporter.rb +1 -1
- data/app/services/decidim/resource_search.rb +17 -164
- data/app/services/decidim/send_push_notification.rb +59 -0
- data/app/services/decidim/traceability.rb +1 -1
- data/app/uploaders/decidim/application_uploader.rb +2 -12
- data/app/uploaders/decidim/cw/attachment_uploader.rb +1 -1
- data/app/uploaders/decidim/cw/{data_portability_uploader.rb → download_your_data_uploader.rb} +3 -3
- data/app/uploaders/decidim/cw/image_uploader.rb +2 -2
- data/app/uploaders/decidim/organization_favicon_uploader.rb +3 -2
- data/app/validators/passthru_validator.rb +29 -21
- data/app/validators/password_validator.rb +25 -4
- data/app/validators/uploader_image_dimensions_validator.rb +1 -1
- data/app/views/decidim/account/_account_notification.js.erb +20 -0
- data/app/views/decidim/account/_password_fields.html.erb +2 -2
- data/app/views/decidim/account/cancel_email_change.js.erb +6 -0
- data/app/views/decidim/account/resend_confirmation_instructions.erb +1 -0
- data/app/views/decidim/account/show.html.erb +19 -6
- data/app/views/decidim/application/{_attachments.html.erb → _attachments.erb} +2 -2
- data/app/views/decidim/application/_collection.html.erb +1 -1
- data/app/views/decidim/application/{_document.html.erb → _document.erb} +0 -0
- data/app/views/decidim/application/{_documents.html.erb → _documents.erb} +2 -2
- data/app/views/decidim/application/{_photos.html.erb → _photos.erb} +0 -0
- data/app/views/decidim/devise/confirmations/new.html.erb +1 -1
- data/app/views/decidim/devise/invitations/edit.html.erb +3 -4
- data/app/views/decidim/devise/omniauth_registrations/new.html.erb +3 -3
- data/app/views/decidim/devise/passwords/edit.html.erb +7 -5
- data/app/views/decidim/devise/passwords/new.html.erb +1 -1
- data/app/views/decidim/devise/registrations/edit.html.erb +5 -5
- data/app/views/decidim/devise/registrations/new.html.erb +5 -5
- data/app/views/decidim/devise/sessions/new.html.erb +2 -2
- data/app/views/decidim/{data_portability → download_your_data}/export.html.erb +0 -0
- data/app/views/decidim/{data_portability → download_your_data}/show.html.erb +2 -2
- data/app/views/decidim/export_mailer/download_your_data_export.html.erb +7 -0
- data/app/views/decidim/last_activities/index.html.erb +1 -1
- data/app/views/decidim/manifests/show.json.erb +31 -0
- data/app/views/decidim/messaging/conversations/_add_conversation_users.html.erb +5 -3
- data/app/views/decidim/messaging/conversations/_reply.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_start.html.erb +1 -3
- data/app/views/decidim/messaging/conversations/create.js.erb +1 -0
- data/app/views/decidim/notifications_digest_mailer/_email_content.html.erb +11 -0
- data/app/views/decidim/notifications_digest_mailer/digest_mail.erb +27 -0
- data/app/views/decidim/notifications_settings/show.html.erb +34 -9
- data/app/views/decidim/offline/show.html.erb +9 -0
- data/app/views/decidim/pages/_standalone.html.erb +1 -1
- data/app/views/decidim/reported_mailer/hide.html.erb +1 -1
- data/app/views/decidim/reported_mailer/report.html.erb +1 -1
- data/app/views/decidim/scopes/picker.html.erb +1 -1
- data/app/views/decidim/searches/_filters.html.erb +2 -2
- data/app/views/decidim/shared/participatory_space_filters/_filters.html.erb +3 -3
- data/app/views/decidim/user_report_mailer/notify.html.erb +10 -3
- data/app/views/devise/mailer/confirmation_instructions.html.erb +3 -1
- data/app/views/layouts/decidim/_application.html.erb +6 -3
- data/app/views/layouts/decidim/_cookie_warning.html.erb +8 -8
- data/app/views/layouts/decidim/_decidim_javascript.html.erb +12 -0
- data/app/views/layouts/decidim/_head.html.erb +4 -2
- data/app/views/layouts/decidim/_js_configuration.html.erb +5 -1
- data/app/views/layouts/decidim/_main_footer.html.erb +1 -0
- data/app/views/layouts/decidim/_offline_banner.html.erb +11 -0
- data/app/views/layouts/decidim/widget.html.erb +2 -2
- data/config/assets.rb +1 -0
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +48 -36
- data/config/locales/bg.yml +15 -30
- data/config/locales/ca.yml +186 -35
- data/config/locales/cs.yml +186 -33
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +25 -36
- data/config/locales/el.yml +15 -30
- data/config/locales/en.yml +183 -32
- data/config/locales/eo.yml +4 -6
- data/config/locales/es-MX.yml +185 -34
- data/config/locales/es-PY.yml +185 -34
- data/config/locales/es.yml +185 -34
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +15 -36
- data/config/locales/fi-plain.yml +184 -33
- data/config/locales/fi.yml +184 -33
- data/config/locales/fr-CA.yml +170 -33
- data/config/locales/fr.yml +170 -33
- data/config/locales/ga-IE.yml +5 -7
- data/config/locales/gl.yml +47 -30
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +65 -35
- data/config/locales/id-ID.yml +15 -29
- data/config/locales/is-IS.yml +6 -15
- data/config/locales/it.yml +22 -38
- data/config/locales/ja.yml +173 -34
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +16 -32
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +15 -28
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +25 -33
- data/config/locales/no.yml +24 -35
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +113 -32
- data/config/locales/pt-BR.yml +17 -32
- data/config/locales/pt.yml +16 -32
- data/config/locales/ro-RO.yml +20 -36
- data/config/locales/ru.yml +15 -27
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +15 -30
- data/config/locales/sl.yml +1 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +1 -0
- data/config/locales/sv.yml +69 -34
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +15 -29
- data/config/locales/uk.yml +15 -26
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +15 -28
- data/config/locales/zh-TW.yml +1 -0
- data/config/routes.rb +17 -2
- data/db/migrate/20180508111710_add_accepted_tos_version_field_to_users.rb +1 -0
- data/db/migrate/20181030090144_destroy_deleted_users_follows.rb +1 -0
- data/db/migrate/20190412131728_fix_user_names.rb +4 -4
- data/db/migrate/20210831181634_add_service_name_to_active_storage_blobs.active_storage.rb +22 -0
- data/db/migrate/20210831181635_create_active_storage_variant_records.active_storage.rb +14 -0
- data/db/migrate/20211208155453_create_decidim_reminders.rb +11 -0
- data/db/migrate/20211209121025_create_decidim_reminder_records.rb +11 -0
- data/db/migrate/20211209121040_create_decidim_reminder_deliveries.rb +10 -0
- data/db/migrate/20220118121921_change_required_description_categories.rb +7 -0
- data/db/migrate/20220127113419_add_notification_settings_to_users.rb +7 -0
- data/db/migrate/20220203121137_add_notifications_sending_frequency_to_users.rb +7 -0
- data/db/migrate/20220215172439_add_digest_sent_at_to_users.rb +7 -0
- data/db/migrate/20220323195258_add_index_to_decidim_users_notifications_sending_frequency.rb +7 -0
- data/db/migrate/20220427142214_drop_emails_on_notifications_flag_from_user.rb +15 -0
- data/db/migrate/20220518094535_add_previous_passwords_to_users.rb +20 -0
- data/db/migrate/20220524195530_create_decidim_short_links.rb +23 -0
- data/db/seeds.rb +17 -18
- data/lib/decidim/acts_as_tree.rb +47 -0
- data/lib/decidim/api/input_sorts/component_input_sort.rb +2 -1
- data/lib/decidim/api/interfaces/authorable_interface.rb +6 -5
- data/lib/decidim/asset_router.rb +80 -0
- data/lib/decidim/attachment_attributes.rb +8 -8
- data/lib/decidim/attribute_object/form.rb +174 -0
- data/lib/decidim/attribute_object/model.rb +148 -0
- data/lib/decidim/attribute_object/nested_validator.rb +22 -0
- data/lib/decidim/attribute_object/type_map.rb +14 -0
- data/lib/decidim/attribute_object/type_resolver.rb +91 -0
- data/lib/decidim/attribute_object.rb +26 -0
- data/lib/decidim/attributes/array.rb +62 -0
- data/lib/decidim/attributes/blob.rb +20 -0
- data/lib/decidim/attributes/clean_string.rb +12 -6
- data/lib/decidim/attributes/hash.rb +36 -0
- data/lib/decidim/attributes/integer.rb +17 -0
- data/lib/decidim/attributes/localized_date.rb +9 -7
- data/lib/decidim/attributes/model.rb +24 -0
- data/lib/decidim/attributes/object.rb +28 -0
- data/lib/decidim/attributes/symbol.rb +23 -0
- data/lib/decidim/attributes/time_with_zone.rb +9 -7
- data/lib/decidim/attributes.rb +29 -0
- data/lib/decidim/authorable.rb +21 -6
- data/lib/decidim/authorization_form_builder.rb +9 -11
- data/lib/decidim/carrier_wave_migrator_service.rb +15 -15
- data/lib/decidim/coauthorable.rb +22 -4
- data/lib/decidim/command.rb +44 -0
- data/lib/decidim/common_passwords.rb +1 -1
- data/lib/decidim/component_manifest.rb +5 -5
- data/lib/decidim/component_validator.rb +2 -2
- data/lib/decidim/content_block_manifest.rb +1 -1
- data/lib/decidim/content_parsers/hashtag_parser.rb +2 -2
- data/lib/decidim/content_parsers/resource_parser.rb +1 -1
- data/lib/decidim/content_parsers/user_group_parser.rb +1 -1
- data/lib/decidim/content_parsers/user_parser.rb +4 -4
- data/lib/decidim/content_renderers/hashtag_renderer.rb +1 -1
- data/lib/decidim/content_renderers/link_renderer.rb +2 -2
- data/lib/decidim/content_renderers/user_group_renderer.rb +1 -1
- data/lib/decidim/content_renderers/user_renderer.rb +1 -1
- data/lib/decidim/controller_helpers.rb +41 -0
- data/lib/decidim/core/engine.rb +29 -18
- data/lib/decidim/core/test/factories.rb +48 -8
- data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +16 -4
- data/lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +15 -2
- data/lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +203 -0
- data/lib/decidim/core/test/shared_examples/localised_email.rb +1 -1
- data/lib/decidim/core/test/shared_examples/logo_email.rb +1 -1
- data/lib/decidim/core/test/shared_examples/map_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/preview_component_with_share_token_examples.rb +0 -6
- data/lib/decidim/core/test/shared_examples/resource_search_examples.rb +120 -40
- data/lib/decidim/core/test/shared_examples/resourceable.rb +0 -6
- data/lib/decidim/core/test/shared_examples/searchable_participatory_space_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/searchable_resources_shared_context.rb +1 -1
- data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +3 -3
- data/lib/decidim/core/test/shared_examples/translated_event_examples.rb +2 -2
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +108 -14
- data/lib/decidim/{data_portability.rb → download_your_data.rb} +3 -3
- data/lib/decidim/{data_portability_serializers/data_portability_conversation_serializer.rb → download_your_data_serializers/download_your_data_conversation_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_follow_serializer.rb → download_your_data_serializers/download_your_data_follow_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_identity_serializer.rb → download_your_data_serializers/download_your_data_identity_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_notification_serializer.rb → download_your_data_serializers/download_your_data_notification_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_participatory_space_private_user_serializer.rb → download_your_data_serializers/download_your_data_participatory_space_private_user_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_report_serializer.rb → download_your_data_serializers/download_your_data_report_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_user_group_serializer.rb → download_your_data_serializers/download_your_data_user_group_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_user_serializer.rb → download_your_data_serializers/download_your_data_user_serializer.rb} +3 -3
- data/lib/decidim/download_your_data_serializers.rb +23 -0
- data/lib/decidim/engine_router.rb +7 -1
- data/lib/decidim/env.rb +56 -0
- data/lib/decidim/event_recorder.rb +25 -0
- data/lib/decidim/events/base_event.rb +10 -14
- data/lib/decidim/events/simple_event.rb +12 -4
- data/lib/decidim/exporters/export_data.rb +1 -1
- data/lib/decidim/exporters/export_manifest.rb +2 -1
- data/lib/decidim/file_validator_humanizer.rb +24 -1
- data/lib/decidim/filterable_resource.rb +55 -0
- data/lib/decidim/fingerprint_calculator.rb +2 -4
- data/lib/decidim/form_builder.rb +158 -130
- data/lib/decidim/gamification/badge.rb +2 -3
- data/lib/decidim/gamification/badge_scorer.rb +1 -0
- data/lib/decidim/has_area.rb +27 -0
- data/lib/decidim/has_attachments.rb +2 -2
- data/lib/decidim/has_category.rb +36 -0
- data/lib/decidim/importers/import_manifest.rb +3 -21
- data/lib/decidim/jsonb_attributes.rb +6 -4
- data/lib/decidim/manifest_messages.rb +23 -0
- data/lib/decidim/map/autocomplete.rb +6 -4
- data/lib/decidim/map/frontend.rb +2 -2
- data/lib/decidim/map/provider/geocoding/here.rb +5 -5
- data/lib/decidim/map/provider/here.rb +3 -0
- data/lib/decidim/map/provider/osm.rb +3 -0
- data/lib/decidim/map.rb +4 -4
- data/lib/decidim/menu.rb +1 -1
- data/lib/decidim/metric_manifest.rb +2 -2
- data/lib/decidim/nicknamizable.rb +1 -1
- data/lib/decidim/notification_setting_manifest.rb +19 -0
- data/lib/decidim/organization_settings.rb +8 -7
- data/lib/decidim/participatory_space_context_manifest.rb +2 -2
- data/lib/decidim/participatory_space_manifest.rb +2 -2
- data/lib/decidim/processes_file_locally.rb +31 -0
- data/lib/decidim/query.rb +84 -0
- data/lib/decidim/record_encryptor.rb +29 -8
- data/lib/decidim/reminder_manifest.rb +75 -0
- data/lib/decidim/reminder_registry.rb +67 -0
- data/lib/decidim/resource_manifest.rb +1 -1
- data/lib/decidim/resourceable.rb +11 -0
- data/lib/decidim/scopable.rb +15 -0
- data/lib/decidim/settings_manifest.rb +4 -4
- data/lib/decidim/spring.rb +16 -0
- data/lib/decidim/translatable_attributes.rb +12 -8
- data/lib/decidim/url_option_resolver.rb +50 -0
- data/lib/decidim/view_hooks.rb +1 -1
- data/lib/decidim/view_model.rb +5 -1
- data/lib/decidim/webpacker/thread_safe_compiler.rb +30 -0
- data/lib/decidim/webpacker/webpack/custom.js +15 -3
- data/lib/decidim/webpacker/webpacker.yml +1 -1
- data/lib/decidim/webpacker.rb +2 -0
- data/lib/devise/models/decidim_validatable.rb +1 -1
- data/lib/tasks/decidim_active_storage_migration_tasks.rake +1 -3
- data/lib/tasks/{decidim_data_portability_tasks.rake → decidim_download_your_data_tasks.rake} +9 -9
- data/lib/tasks/decidim_mailers_tasks.rake +23 -0
- data/lib/tasks/decidim_metrics_tasks.rake +1 -1
- data/lib/tasks/decidim_pwa_tasks.rake +18 -0
- data/lib/tasks/decidim_reminders_tasks.rake +17 -0
- data/lib/tasks/decidim_tasks.rake +6 -1
- data/lib/tasks/decidim_webpacker_tasks.rake +1 -1
- data/lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake +51 -0
- metadata +184 -83
- data/app/controllers/decidim/cookie_policy_controller.rb +0 -24
- data/app/helpers/decidim/cookies_helper.rb +0 -11
- data/app/packs/src/decidim/vizzs/renders.js +0 -9
- data/app/packs/src/decidim/vizzs.js +0 -1
- data/app/packs/stylesheets/decidim/modules/_cookie-bar.scss +0 -26
- data/app/services/decidim/home_activity_search.rb +0 -80
- data/app/services/decidim/participatory_space_search.rb +0 -54
- data/app/views/decidim/cookie_policy/accept.js.erb +0 -3
- data/app/views/decidim/export_mailer/data_portability_export.html.erb +0 -7
- data/lib/decidim/data_portability_serializers.rb +0 -23
- data/lib/decidim/middleware/rails_cookies.rb +0 -23
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# A command with the business logic to invite a user to an organization.
|
|
5
|
-
class InviteUser <
|
|
5
|
+
class InviteUser < Decidim::Command
|
|
6
6
|
# Public: Initializes the command.
|
|
7
7
|
#
|
|
8
8
|
# form - A form object with the params.
|
|
@@ -27,9 +27,7 @@ module Decidim
|
|
|
27
27
|
attr_reader :form
|
|
28
28
|
|
|
29
29
|
def user
|
|
30
|
-
# rubocop:disable Rails/FindBy
|
|
31
30
|
@user ||= Decidim::User.where(organization: form.organization).where(email: form.email.downcase).first
|
|
32
|
-
# rubocop:enable Rails/FindBy
|
|
33
31
|
end
|
|
34
32
|
|
|
35
33
|
def update_user
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# A command with the business logic to invite an user to an organization.
|
|
5
|
-
class InviteUserAgain <
|
|
5
|
+
class InviteUserAgain < Decidim::Command
|
|
6
6
|
# Public: Initializes the command.
|
|
7
7
|
#
|
|
8
8
|
# user - The user that receives the invitation instructions.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# A command with all the business logic to leave a user group.
|
|
5
|
-
class LeaveUserGroup <
|
|
5
|
+
class LeaveUserGroup < Decidim::Command
|
|
6
6
|
# Public: Initializes the command.
|
|
7
7
|
#
|
|
8
8
|
# user - the user that wants to leave the group
|
|
@@ -20,6 +20,7 @@ module Decidim
|
|
|
20
20
|
# Returns nothing.
|
|
21
21
|
def call
|
|
22
22
|
return broadcast(:invalid) unless can_leave?
|
|
23
|
+
return broadcast(:last_admin) if last_admin?
|
|
23
24
|
|
|
24
25
|
leave_user_group
|
|
25
26
|
|
|
@@ -35,7 +36,12 @@ module Decidim
|
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
def can_leave?
|
|
38
|
-
Decidim::UserGroupMembership.where(user: user, user_group: user_group).
|
|
39
|
+
Decidim::UserGroupMembership.where(user: user, user_group: user_group).any?
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def last_admin?
|
|
43
|
+
admin_memberships = Decidim::UserGroupMembership.where(user_group: user_group, role: [:creator, :admin])
|
|
44
|
+
admin_memberships.length == 1 && admin_memberships.pluck(:decidim_user_id).include?(user.id)
|
|
39
45
|
end
|
|
40
46
|
end
|
|
41
47
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Decidim
|
|
4
4
|
module Messaging
|
|
5
5
|
# A command with all the business logic for replying to a conversation
|
|
6
|
-
class ReplyToConversation <
|
|
6
|
+
class ReplyToConversation < Decidim::Command
|
|
7
7
|
# Public: Initializes the command.
|
|
8
8
|
#
|
|
9
9
|
# conversation - The conversation to be updated.
|
|
@@ -72,7 +72,7 @@ module Decidim
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# in order for a recipient to receive an email it should not have direct-messages disabled
|
|
75
|
-
# if direct-messages are disabled, only send if
|
|
75
|
+
# if direct-messages are disabled, only send if they follow the sending user
|
|
76
76
|
def notify(recipient)
|
|
77
77
|
return unless conversation.unread_count(recipient) == 1
|
|
78
78
|
return unless recipient.accepts_conversation?(form.context.current_user)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Decidim
|
|
4
4
|
module Messaging
|
|
5
5
|
# A command with all the business logic for replying to a conversation
|
|
6
|
-
class StartConversation <
|
|
6
|
+
class StartConversation < Decidim::Command
|
|
7
7
|
# Public: Initializes the command.
|
|
8
8
|
#
|
|
9
9
|
# form - A conversation form
|
|
@@ -72,7 +72,7 @@ module Decidim
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# in order for a recipient to receive an email it should not have direct-messages disabled
|
|
75
|
-
# if direct-messages are disabled, only send if
|
|
75
|
+
# if direct-messages are disabled, only send if they follow the sending user
|
|
76
76
|
def notify(recipient)
|
|
77
77
|
return unless recipient.accepts_conversation?(form.context.current_user)
|
|
78
78
|
|
|
@@ -6,16 +6,25 @@ module Decidim
|
|
|
6
6
|
|
|
7
7
|
def build_attachments
|
|
8
8
|
@documents = []
|
|
9
|
-
@form.add_documents.each do |
|
|
9
|
+
@form.add_documents.compact_blank.each do |attachment|
|
|
10
|
+
if attachment.is_a?(Hash) && attachment.has_key?(:id)
|
|
11
|
+
update_attachment_title_for(attachment)
|
|
12
|
+
next
|
|
13
|
+
end
|
|
14
|
+
|
|
10
15
|
@documents << Attachment.new(
|
|
11
|
-
title:
|
|
16
|
+
title: title_for(attachment),
|
|
12
17
|
attached_to: @attached_to || documents_attached_to,
|
|
13
|
-
file:
|
|
14
|
-
content_type:
|
|
18
|
+
file: signed_id_for(attachment),
|
|
19
|
+
content_type: content_type_for(attachment)
|
|
15
20
|
)
|
|
16
21
|
end
|
|
17
22
|
end
|
|
18
23
|
|
|
24
|
+
def update_attachment_title_for(attachment)
|
|
25
|
+
Decidim::Attachment.find(attachment[:id]).update(title: title_for(attachment))
|
|
26
|
+
end
|
|
27
|
+
|
|
19
28
|
def attachments_invalid?
|
|
20
29
|
@documents.each do |document|
|
|
21
30
|
next if document.valid? || !document.errors.has_key?(:file)
|
|
@@ -30,10 +39,18 @@ module Decidim
|
|
|
30
39
|
false
|
|
31
40
|
end
|
|
32
41
|
|
|
33
|
-
def create_attachments
|
|
42
|
+
def create_attachments(first_weight: 0)
|
|
43
|
+
weight = first_weight
|
|
44
|
+
# Add the weights first to the old document
|
|
45
|
+
@form.documents.each do |document|
|
|
46
|
+
document.update!(weight: weight)
|
|
47
|
+
weight += 1
|
|
48
|
+
end
|
|
34
49
|
@documents.map! do |document|
|
|
50
|
+
document.weight = weight
|
|
35
51
|
document.attached_to = documents_attached_to
|
|
36
52
|
document.save!
|
|
53
|
+
weight += 1
|
|
37
54
|
@form.documents << document
|
|
38
55
|
end
|
|
39
56
|
end
|
|
@@ -57,5 +74,27 @@ module Decidim
|
|
|
57
74
|
|
|
58
75
|
form.current_component.organization if form.respond_to?(:current_component)
|
|
59
76
|
end
|
|
77
|
+
|
|
78
|
+
def signed_id_for(attachment)
|
|
79
|
+
return attachment[:file] if attachment.is_a?(Hash)
|
|
80
|
+
|
|
81
|
+
attachment
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def title_for(attachment)
|
|
85
|
+
return { I18n.locale => attachment[:title] } if attachment.is_a?(Hash) && attachment.has_key?(:title)
|
|
86
|
+
|
|
87
|
+
{ I18n.locale => "" }
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def content_type_for(attachment)
|
|
91
|
+
return attachment.content_type if attachment.instance_of?(ActionDispatch::Http::UploadedFile)
|
|
92
|
+
|
|
93
|
+
blob(signed_id_for(attachment)).content_type
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def blob(signed_id)
|
|
97
|
+
ActiveStorage::Blob.find_signed(signed_id)
|
|
98
|
+
end
|
|
60
99
|
end
|
|
61
100
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# A command with all the business logic to promote a user to group admin.
|
|
5
|
-
class PromoteMembership <
|
|
5
|
+
class PromoteMembership < Decidim::Command
|
|
6
6
|
# Public: Initializes the command.
|
|
7
7
|
#
|
|
8
8
|
# membership - the UserGroupMembership to be promoted.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# A command with all the business logic to reject an invitation to belong to a
|
|
5
5
|
# group.
|
|
6
|
-
class RejectGroupInvitation <
|
|
6
|
+
class RejectGroupInvitation < Decidim::Command
|
|
7
7
|
# Public: Initializes the command.
|
|
8
8
|
#
|
|
9
9
|
# user_group - the UserGroup where the user has been invited
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# A command with all the business logic to reject a join request to a user
|
|
5
5
|
# group.
|
|
6
|
-
class RejectUserGroupJoinRequest <
|
|
6
|
+
class RejectUserGroupJoinRequest < Decidim::Command
|
|
7
7
|
# Public: Initializes the command.
|
|
8
8
|
#
|
|
9
9
|
# membership - the UserGroupMembership to be accepted.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# A command with all the business logic to remove a user from a group.
|
|
5
|
-
class RemoveUserFromGroup <
|
|
5
|
+
class RemoveUserFromGroup < Decidim::Command
|
|
6
6
|
# Public: Initializes the command.
|
|
7
7
|
#
|
|
8
8
|
# membership - the UserGroupMembership to be accepted.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
class ResendConfirmationInstructions < Decidim::Command
|
|
5
|
+
def initialize(user)
|
|
6
|
+
@user = user
|
|
7
|
+
@unconfirmed_email = user.unconfirmed_email
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def call
|
|
11
|
+
return broadcast(:invalid) unless @unconfirmed_email
|
|
12
|
+
|
|
13
|
+
ResendConfirmationInstructionsJob.perform_later(@user)
|
|
14
|
+
|
|
15
|
+
broadcast(:ok)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# A command that will act as a search service, with all the business logic for performing searches.
|
|
5
|
-
class Search <
|
|
6
|
-
ACCEPTED_FILTERS = [:
|
|
5
|
+
class Search < Decidim::Command
|
|
6
|
+
ACCEPTED_FILTERS = [:decidim_scope_id_eq].freeze
|
|
7
7
|
HIGHLIGHTED_RESULTS_COUNT = 4
|
|
8
8
|
|
|
9
9
|
# Public: Initializes the command.
|
|
@@ -30,9 +30,9 @@ module Decidim
|
|
|
30
30
|
result_ids = filtered_query_for(class_name).pluck(:resource_id)
|
|
31
31
|
results_count = result_ids.count
|
|
32
32
|
|
|
33
|
-
results = if filters[:
|
|
33
|
+
results = if filters[:with_resource_type].present? && filters[:with_resource_type] == class_name
|
|
34
34
|
paginate(klass.order_by_id_list(result_ids))
|
|
35
|
-
elsif filters[:
|
|
35
|
+
elsif filters[:with_resource_type].present?
|
|
36
36
|
ApplicationRecord.none
|
|
37
37
|
else
|
|
38
38
|
klass.order_by_id_list(result_ids.take(HIGHLIGHTED_RESULTS_COUNT))
|
|
@@ -59,15 +59,15 @@ module Decidim
|
|
|
59
59
|
def clean_filters
|
|
60
60
|
@clean_filters ||= filters.select do |attribute_name, value|
|
|
61
61
|
ACCEPTED_FILTERS.include?(attribute_name.to_sym) && value.present?
|
|
62
|
-
end.
|
|
62
|
+
end.compact
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def spaces_to_filter
|
|
66
|
-
return nil if filters[:
|
|
66
|
+
return nil if filters[:with_space_state].blank?
|
|
67
67
|
|
|
68
68
|
Decidim.participatory_space_manifests.flat_map do |manifest|
|
|
69
69
|
public_spaces = manifest.participatory_spaces.call(organization).public_spaces
|
|
70
|
-
spaces = case filters[:
|
|
70
|
+
spaces = case filters[:with_space_state]
|
|
71
71
|
when "active"
|
|
72
72
|
public_spaces.active_spaces
|
|
73
73
|
when "future"
|
|
@@ -88,9 +88,10 @@ module Decidim
|
|
|
88
88
|
resource_type: class_name
|
|
89
89
|
)
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
query = query.where(
|
|
91
|
+
if (spaces = spaces_to_filter)
|
|
92
|
+
query = query.where(decidim_participatory_space: spaces)
|
|
93
93
|
end
|
|
94
|
+
query = query.ransack(clean_filters).result if clean_filters.any?
|
|
94
95
|
|
|
95
96
|
query = query.order("datetime DESC")
|
|
96
97
|
query = query.global_search(I18n.transliterate(term)) if term.present?
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# A command with all the business logic to unendorse a resource, both as a user or as a user_group.
|
|
5
|
-
class UnendorseResource <
|
|
5
|
+
class UnendorseResource < Decidim::Command
|
|
6
6
|
# Public: Initializes the command.
|
|
7
7
|
#
|
|
8
8
|
# resource - A Decidim::Endorsable object.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# This command updates the user's account.
|
|
5
|
-
class UpdateAccount <
|
|
5
|
+
class UpdateAccount < Decidim::Command
|
|
6
6
|
# Updates a user's account.
|
|
7
7
|
#
|
|
8
8
|
# user - The user to be updated.
|
|
@@ -42,7 +42,7 @@ module Decidim
|
|
|
42
42
|
|
|
43
43
|
def update_avatar
|
|
44
44
|
if @form.avatar.present?
|
|
45
|
-
@user.avatar
|
|
45
|
+
@user.avatar.attach(@form.avatar)
|
|
46
46
|
elsif @form.remove_avatar
|
|
47
47
|
@user.avatar = nil
|
|
48
48
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# This command updates the user's notifications settings.
|
|
5
|
-
class UpdateNotificationsSettings <
|
|
5
|
+
class UpdateNotificationsSettings < Decidim::Command
|
|
6
6
|
# Updates a user's notifications settings.
|
|
7
7
|
#
|
|
8
8
|
# user - The user to be updated.
|
|
@@ -24,11 +24,12 @@ module Decidim
|
|
|
24
24
|
private
|
|
25
25
|
|
|
26
26
|
def update_notifications_settings
|
|
27
|
-
@user.email_on_notification = @form.email_on_notification
|
|
28
27
|
@user.newsletter_notifications_at = @form.newsletter_notifications_at
|
|
29
28
|
@user.notification_types = @form.notification_types
|
|
30
29
|
@user.direct_message_types = @form.direct_message_types
|
|
31
30
|
@user.email_on_moderations = @form.email_on_moderations
|
|
31
|
+
@user.notification_settings = @user.notification_settings.merge(@form.notification_settings)
|
|
32
|
+
@user.notifications_sending_frequency = @form.notifications_sending_frequency
|
|
32
33
|
end
|
|
33
34
|
end
|
|
34
35
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
# Decidim command updates user's password
|
|
5
|
+
class UpdatePassword < Decidim::Command
|
|
6
|
+
# Updates a user's password.
|
|
7
|
+
#
|
|
8
|
+
# user - The user to be updated.
|
|
9
|
+
# form - The form with the data.
|
|
10
|
+
def initialize(user, form)
|
|
11
|
+
@user = user
|
|
12
|
+
@form = form
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def call
|
|
16
|
+
return broadcast(:invalid) if form.invalid?
|
|
17
|
+
|
|
18
|
+
user.password = form.password
|
|
19
|
+
|
|
20
|
+
if user.save
|
|
21
|
+
broadcast(:ok)
|
|
22
|
+
else
|
|
23
|
+
broadcast(:invalid)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
attr_reader :form, :user
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# A command with all the business logic to update a user group profile.
|
|
5
|
-
class UpdateUserGroup <
|
|
5
|
+
class UpdateUserGroup < Decidim::Command
|
|
6
6
|
# Public: Initializes the command.
|
|
7
7
|
#
|
|
8
8
|
# form - A form object with the params.
|
|
@@ -60,7 +60,7 @@ module Decidim
|
|
|
60
60
|
affected_users: Decidim::User.org_admins_except_me(form.current_user)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
Decidim::EventsManager.publish(data)
|
|
63
|
+
Decidim::EventsManager.publish(**data)
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
class ValidateUpload < Decidim::Command
|
|
5
|
+
def initialize(form)
|
|
6
|
+
@form = form
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def call
|
|
10
|
+
return broadcast(:invalid, @form.errors) if @form.invalid?
|
|
11
|
+
|
|
12
|
+
broadcast(:ok)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -20,20 +20,24 @@ module Decidim
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def respond_to_missing?(method_name, include_private = false)
|
|
23
|
-
@filter.present? && @filter.has_key?(method_name) || super
|
|
23
|
+
(@filter.present? && @filter.has_key?(method_name)) || super
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
included do
|
|
28
|
-
helper_method :search, :filter
|
|
28
|
+
helper_method :search, :filter_params, :filter
|
|
29
29
|
|
|
30
30
|
private
|
|
31
31
|
|
|
32
32
|
def search
|
|
33
|
-
@search ||=
|
|
33
|
+
@search ||= search_with(filter_params)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
def
|
|
36
|
+
def search_with(provided_params)
|
|
37
|
+
search_collection.ransack(provided_params, context_params.merge(auth_object: current_user))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def search_collection
|
|
37
41
|
raise NotImplementedError, "A search class is neeeded to filter resources"
|
|
38
42
|
end
|
|
39
43
|
|
|
@@ -41,19 +45,15 @@ module Decidim
|
|
|
41
45
|
@filter ||= Filter.new(filter_params)
|
|
42
46
|
end
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
|
|
48
|
+
# Fetches the correct filter parameters from the request parameters in
|
|
49
|
+
# order to limit the parameters which can be used for searching the
|
|
50
|
+
# resources. Otherwise the user could pass extra search parameters from
|
|
51
|
+
# the request using the Ransack API.
|
|
50
52
|
def filter_params
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def default_search_params
|
|
56
|
-
{}
|
|
53
|
+
@filter_params = begin
|
|
54
|
+
passed_params = params.to_unsafe_h[:filter].try(:symbolize_keys) || {}
|
|
55
|
+
default_filter_params.merge(passed_params.slice(*default_filter_params.keys))
|
|
56
|
+
end
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def default_filter_params
|
|
@@ -76,14 +76,13 @@ module Decidim
|
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
# If the controller responds to current_component, its
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
# available locales from the organization in Decidim::ResourceSearch.
|
|
79
|
+
# If the controller responds to current_component, its is probably
|
|
80
|
+
# searching against that component. Otherwise it is be likely to search
|
|
81
|
+
# against a participatory space. The context params are passed to the
|
|
82
|
+
# Ransack search classes which may be customized per model in case they
|
|
83
|
+
# need this contextual information. For such searches, take a look at the
|
|
84
|
+
# ResourceSearch class or any search class inheriting from that which
|
|
85
|
+
# utilize this context information, such as the current user.
|
|
87
86
|
def context_params
|
|
88
87
|
context = {
|
|
89
88
|
current_user: current_user,
|
|
@@ -36,8 +36,7 @@ module Decidim
|
|
|
36
36
|
|
|
37
37
|
def unauthorized_paths
|
|
38
38
|
# /locale is for changing the locale
|
|
39
|
-
|
|
40
|
-
%w(/locale /cookies) + Decidim::StaticPage.where(
|
|
39
|
+
%w(/locale) + Decidim::StaticPage.where(
|
|
41
40
|
organization: current_organization,
|
|
42
41
|
allow_public_access: true
|
|
43
42
|
).pluck(Arel.sql("CONCAT('/pages/', slug)"))
|
|
@@ -13,9 +13,9 @@ module Decidim
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def disable_http_caching
|
|
16
|
-
response.headers["Cache-Control"] = "no-cache, no-store"
|
|
17
16
|
response.headers["Pragma"] = "no-cache"
|
|
18
17
|
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
|
|
18
|
+
response.cache_control.replace(no_cache: true, extras: ["no-store"])
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
# Force user to "Change your password" view when they need to change password
|
|
5
|
+
module NeedsPasswordChange
|
|
6
|
+
extend ActiveSupport::Concern
|
|
7
|
+
|
|
8
|
+
included do
|
|
9
|
+
before_action :check_password_update_required
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def check_password_update_required
|
|
15
|
+
return unless request.format.html?
|
|
16
|
+
return unless current_user
|
|
17
|
+
return unless current_user.admin?
|
|
18
|
+
return unless Decidim.config.admin_password_strong
|
|
19
|
+
return unless current_user.needs_password_update?
|
|
20
|
+
return if password_update_permitted_path?(request.path)
|
|
21
|
+
|
|
22
|
+
redirect_to_change_password
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def password_update_permitted_path?(target_path)
|
|
26
|
+
permitted_paths = [(tos_path if respond_to?(:tos_path, true)),
|
|
27
|
+
decidim.delete_account_path,
|
|
28
|
+
decidim.accept_tos_path,
|
|
29
|
+
decidim.download_your_data_path,
|
|
30
|
+
decidim.export_download_your_data_path,
|
|
31
|
+
decidim.download_file_download_your_data_path,
|
|
32
|
+
decidim.change_password_path].compact
|
|
33
|
+
# ensure that path with or without query string pass
|
|
34
|
+
permitted_paths.find { |el| el.split("?").first == target_path }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def redirect_to_change_password
|
|
38
|
+
flash[:notice] = flash[:notice] if flash[:notice]
|
|
39
|
+
flash[:secondary] = t("decidim.admin.password_change.alert")
|
|
40
|
+
redirect_to decidim.change_password_path
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -29,9 +29,9 @@ module Decidim
|
|
|
29
29
|
permitted_paths = [tos_path,
|
|
30
30
|
decidim.delete_account_path,
|
|
31
31
|
decidim.accept_tos_path,
|
|
32
|
-
decidim.
|
|
33
|
-
decidim.
|
|
34
|
-
decidim.
|
|
32
|
+
decidim.download_your_data_path,
|
|
33
|
+
decidim.export_download_your_data_path,
|
|
34
|
+
decidim.download_file_download_your_data_path]
|
|
35
35
|
# ensure that path with or without query string pass
|
|
36
36
|
permitted_paths.find { |el| el.split("?").first == request.path }
|
|
37
37
|
end
|
|
@@ -17,8 +17,8 @@ module Decidim
|
|
|
17
17
|
#
|
|
18
18
|
# Returns nothing.
|
|
19
19
|
def participatory_space_layout(options = {})
|
|
20
|
-
layout :layout, options
|
|
21
|
-
before_action :authorize_participatory_space, options
|
|
20
|
+
layout :layout, **options
|
|
21
|
+
before_action :authorize_participatory_space, **options
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|