decidim-core 0.23.0 → 0.24.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/assets/images/decidim/icons.svg +1 -1
- data/app/assets/javascripts/decidim.js.es6 +1 -0
- data/app/assets/javascripts/decidim/core/bundle.js +1 -1
- data/app/assets/javascripts/decidim/core/bundle.js.map +1 -1
- data/app/assets/javascripts/decidim/editor.js.es6 +15 -4
- data/app/assets/javascripts/decidim/editor/history_override.js.es6 +117 -0
- data/app/assets/javascripts/decidim/editor/linebreak_module.js.es6 +83 -0
- data/app/assets/javascripts/decidim/editor/modified_backspace_offset1.js.es6 +98 -0
- data/app/assets/javascripts/decidim/editor/modified_backspace_offset_any.js.es6 +48 -0
- data/app/assets/javascripts/decidim/editor/modified_backspace_utils.js.es6 +31 -0
- data/app/assets/javascripts/decidim/editor/modified_enter.js.es6 +118 -0
- data/app/assets/javascripts/decidim/form_filter.component.js.es6 +25 -0
- data/app/assets/javascripts/decidim/geocoding/attach_input.js.es6 +41 -4
- data/app/assets/javascripts/decidim/input_character_counter.js.es6 +6 -1
- data/app/assets/javascripts/decidim/map/controller/markers.js.es6 +27 -9
- data/app/assets/javascripts/decidim/session_timeouter.js.es6 +78 -0
- data/app/assets/stylesheets/decidim/_variables.scss +9 -0
- data/app/assets/stylesheets/decidim/email.scss +14 -2
- data/app/assets/stylesheets/decidim/extras/_external-links.scss +0 -1
- data/app/assets/stylesheets/decidim/extras/_process_stats.scss +1 -1
- data/app/assets/stylesheets/decidim/extras/_results-per-page.scss +1 -0
- data/app/assets/stylesheets/decidim/layouts/_home.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_author-avatar.scss +2 -2
- data/app/assets/stylesheets/decidim/modules/_buttons.scss +2 -2
- data/app/assets/stylesheets/decidim/modules/_cards.scss +18 -1
- data/app/assets/stylesheets/decidim/modules/_collapsible-list.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_comments.scss +5 -1
- data/app/assets/stylesheets/decidim/modules/_conference-speaker.scss +4 -3
- data/app/assets/stylesheets/decidim/modules/_data-picker.scss +7 -0
- data/app/assets/stylesheets/decidim/modules/_extra.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_forms.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_loading-spinner.scss +34 -0
- data/app/assets/stylesheets/decidim/modules/_modules.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_opinion-toggle.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_reveal.scss +6 -0
- data/app/assets/stylesheets/decidim/modules/_signup.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/{_process-stats.scss → _space-stats.scss} +1 -1
- data/app/cells/decidim/activity_cell.rb +11 -8
- data/app/cells/decidim/announcement/show.erb +4 -4
- data/app/cells/decidim/announcement_cell.rb +22 -2
- data/app/cells/decidim/author/flag_user.erb +10 -0
- data/app/cells/decidim/author/profile_minicard.erb +1 -1
- data/app/cells/decidim/author_cell.rb +9 -1
- data/app/cells/decidim/card_m/top.erb +1 -1
- data/app/cells/decidim/card_m_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/cta/show.erb +14 -0
- data/app/cells/decidim/content_blocks/cta_cell.rb +35 -0
- data/app/cells/decidim/content_blocks/cta_settings_form/show.erb +9 -0
- data/app/cells/decidim/content_blocks/cta_settings_form_cell.rb +13 -0
- data/app/cells/decidim/content_blocks/hero_cell.rb +14 -0
- data/app/cells/decidim/content_blocks/highlighted_elements/elements.erb +0 -0
- data/app/cells/decidim/content_blocks/highlighted_elements/heading.erb +0 -0
- data/app/cells/decidim/content_blocks/highlighted_elements/show.erb +4 -0
- data/app/cells/decidim/content_blocks/highlighted_elements_cell.rb +51 -0
- data/app/cells/decidim/content_blocks/highlighted_elements_settings_form/show.erb +3 -0
- data/app/cells/decidim/content_blocks/highlighted_elements_settings_form_cell.rb +28 -0
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +11 -0
- data/app/cells/decidim/content_blocks/metrics_cell.rb +0 -6
- data/app/cells/decidim/content_blocks/stats_cell.rb +0 -6
- data/app/cells/decidim/content_blocks/sub_hero/show.erb +3 -1
- data/app/cells/decidim/date/show.erb +31 -0
- data/app/cells/decidim/date_cell.rb +50 -0
- data/app/cells/decidim/endorsement_buttons_cell.rb +3 -3
- data/app/cells/decidim/flag_modal/flag_user.erb +24 -0
- data/app/cells/decidim/flag_modal/show.erb +24 -0
- data/app/cells/decidim/flag_modal_cell.rb +25 -0
- data/app/cells/decidim/profile/inaccessible.erb +9 -0
- data/app/cells/decidim/profile_cell.rb +9 -1
- data/app/cells/decidim/profile_sidebar/show.erb +10 -1
- data/app/cells/decidim/profile_sidebar_cell.rb +1 -0
- data/app/cells/decidim/reported_content/show.erb +5 -0
- data/app/cells/decidim/reported_content_cell.rb +44 -0
- data/app/cells/decidim/scopes_picker/scope_picker_prompt.erb +3 -0
- data/app/cells/decidim/scopes_picker/scope_picker_values.erb +5 -0
- data/app/cells/decidim/scopes_picker/show.erb +14 -0
- data/app/cells/decidim/scopes_picker_cell.rb +93 -0
- data/app/cells/decidim/tos_page/announcement.erb +1 -2
- data/app/cells/decidim/tos_page/form.erb +19 -0
- data/app/cells/decidim/tos_page_cell.rb +10 -8
- data/app/cells/decidim/translation_bar_cell.rb +1 -1
- data/app/cells/decidim/user_conversation/conversation_header.erb +1 -1
- data/app/cells/decidim/user_conversations_cell.rb +1 -1
- data/app/commands/decidim/attachment_methods.rb +8 -0
- data/app/commands/decidim/create_report.rb +11 -1
- data/app/commands/decidim/create_user_report.rb +67 -0
- data/app/commands/decidim/gallery_methods.rb +2 -2
- data/app/commands/decidim/multiple_attachments_methods.rb +14 -10
- data/app/commands/decidim/search.rb +5 -2
- data/app/commands/decidim/update_notifications_settings.rb +1 -0
- data/app/commands/decidim/update_user_group.rb +1 -0
- data/app/controllers/concerns/decidim/devise_controllers.rb +1 -0
- data/app/controllers/concerns/decidim/flaggable.rb +5 -1
- data/app/controllers/concerns/decidim/force_authentication.rb +11 -3
- data/app/controllers/concerns/decidim/locale_switcher.rb +5 -0
- data/app/controllers/concerns/decidim/needs_permission.rb +7 -1
- data/app/controllers/concerns/decidim/orderable.rb +3 -1
- data/app/controllers/concerns/decidim/user_blocked_checker.rb +26 -0
- data/app/controllers/decidim/application_controller.rb +22 -0
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +3 -1
- data/app/controllers/decidim/devise/sessions_controller.rb +10 -6
- data/app/controllers/decidim/errors_controller.rb +1 -1
- data/app/controllers/decidim/locales_controller.rb +1 -1
- data/app/controllers/decidim/profiles_controller.rb +6 -0
- data/app/controllers/decidim/report_users_controller.rb +42 -0
- data/app/controllers/decidim/scopes_controller.rb +19 -10
- data/app/controllers/decidim/timeouts_controller.rb +28 -0
- data/app/controllers/decidim/user_activities_controller.rb +5 -0
- data/app/controllers/decidim/user_timeline_controller.rb +1 -0
- data/app/events/decidim/demoted_membership_event.rb +2 -2
- data/app/events/decidim/invited_to_group_event.rb +2 -2
- data/app/events/decidim/join_request_accepted_event.rb +2 -2
- data/app/events/decidim/join_request_created_event.rb +2 -2
- data/app/events/decidim/join_request_rejected_event.rb +2 -2
- data/app/events/decidim/promoted_to_admin_event.rb +2 -2
- data/app/events/decidim/removed_from_group_event.rb +2 -2
- data/app/forms/decidim/account_form.rb +1 -1
- data/app/forms/decidim/attachment_form.rb +1 -0
- data/app/forms/decidim/invite_user_form.rb +2 -2
- data/app/forms/decidim/messaging/conversation_form.rb +1 -1
- data/app/forms/decidim/messaging/message_form.rb +1 -1
- data/app/forms/decidim/notifications_settings_form.rb +20 -0
- data/app/forms/url_validator.rb +20 -0
- data/app/helpers/decidim/action_authorization_helper.rb +2 -0
- data/app/helpers/decidim/application_helper.rb +1 -2
- data/app/helpers/decidim/cells_helper.rb +6 -0
- data/app/helpers/decidim/filters_helper.rb +9 -0
- data/app/helpers/decidim/messaging/conversation_helper.rb +11 -1
- data/app/helpers/decidim/newsletters_helper.rb +7 -9
- data/app/helpers/decidim/paginate_helper.rb +1 -10
- data/app/helpers/decidim/sanitize_helper.rb +8 -0
- data/app/helpers/decidim/scopes_helper.rb +2 -2
- data/app/jobs/decidim/block_user_job.rb +11 -0
- data/app/jobs/decidim/data_portability_export_job.rb +3 -3
- data/app/jobs/decidim/export_job.rb +2 -2
- data/app/jobs/decidim/find_and_update_descendants_job.rb +48 -0
- data/app/jobs/decidim/machine_translation_resource_job.rb +3 -0
- data/app/jobs/decidim/machine_translation_save_job.rb +29 -0
- data/app/jobs/decidim/open_data_job.rb +1 -1
- data/app/jobs/decidim/update_search_indexes_job.rb +11 -0
- data/app/jobs/decidim/user_report_job.rb +11 -0
- data/app/mailers/decidim/application_mailer.rb +1 -0
- data/app/mailers/decidim/block_user_mailer.rb +21 -0
- data/app/mailers/decidim/reported_mailer.rb +33 -3
- data/app/mailers/decidim/user_report_mailer.rb +21 -0
- data/app/models/decidim/area.rb +0 -1
- data/app/models/decidim/area_type.rb +1 -1
- data/app/models/decidim/attachment.rb +3 -2
- data/app/models/decidim/attachment_collection.rb +1 -1
- data/app/models/decidim/authorization.rb +4 -0
- data/app/models/decidim/category.rb +6 -1
- data/app/models/decidim/impersonation_log.rb +5 -7
- data/app/models/decidim/metric.rb +2 -2
- data/app/models/decidim/moderation.rb +12 -0
- data/app/models/decidim/organization.rb +6 -2
- data/app/models/decidim/scope.rb +5 -2
- data/app/models/decidim/scope_type.rb +1 -1
- data/app/models/decidim/share_token.rb +1 -1
- data/app/models/decidim/static_page.rb +11 -1
- data/app/models/decidim/static_page_topic.rb +4 -0
- data/app/models/decidim/user.rb +23 -4
- data/app/models/decidim/user_base_entity.rb +12 -12
- data/app/models/decidim/user_block.rb +10 -0
- data/app/models/decidim/user_group.rb +1 -0
- data/app/models/decidim/user_moderation.rb +22 -0
- data/app/models/decidim/user_report.rb +31 -0
- data/app/permissions/decidim/permissions.rb +1 -3
- data/app/permissions/decidim/report_user_permissions.rb +13 -0
- data/app/presenters/decidim/admin_log/component_presenter.rb +2 -2
- data/app/presenters/decidim/admin_log/impersonation_log_presenter.rb +39 -0
- data/app/presenters/decidim/admin_log/moderation_presenter.rb +2 -2
- data/app/presenters/decidim/admin_log/organization_presenter.rb +3 -4
- data/app/presenters/decidim/admin_log/user_moderation_presenter.rb +63 -0
- data/app/presenters/decidim/admin_log/user_presenter.rb +19 -10
- data/app/presenters/decidim/home_stats_presenter.rb +3 -3
- data/app/presenters/decidim/log/base_presenter.rb +9 -1
- data/app/presenters/decidim/log/diff_presenter.rb +4 -3
- data/app/presenters/decidim/log/resource_presenter.rb +4 -4
- data/app/presenters/decidim/log/user_presenter.rb +1 -1
- data/app/presenters/decidim/menu_presenter.rb +12 -7
- data/app/presenters/decidim/nil_presenter.rb +0 -2
- data/app/presenters/decidim/user_presenter.rb +1 -1
- data/app/queries/decidim/metrics/blocked_users_metric_manage.rb +26 -0
- data/app/queries/decidim/metrics/followers_metric_manage.rb +3 -0
- data/app/queries/decidim/metrics/participants_metric_manage.rb +3 -0
- data/app/queries/decidim/metrics/reported_users_metric_manage.rb +26 -0
- data/app/queries/decidim/metrics/user_reports_metric_manage.rb +26 -0
- data/app/scrubbers/decidim/newsletter_scrubber.rb +31 -0
- data/app/services/decidim/activity_search.rb +1 -3
- data/app/services/decidim/base_diff_renderer.rb +1 -1
- data/app/services/decidim/data_portability_exporter.rb +1 -0
- data/app/services/decidim/email_notification_generator.rb +2 -2
- data/app/services/decidim/events_manager.rb +1 -1
- data/app/services/decidim/open_data_exporter.rb +36 -7
- data/app/services/decidim/tokenizer.rb +38 -0
- data/app/services/decidim/traceability.rb +3 -0
- data/app/services/decidim/zip_stream/zip_stream_writer.rb +3 -3
- data/app/uploaders/decidim/application_uploader.rb +24 -0
- data/app/uploaders/decidim/attachment_uploader.rb +2 -4
- data/app/uploaders/decidim/downloader.rb +9 -0
- data/app/uploaders/decidim/image_uploader.rb +9 -21
- data/app/uploaders/decidim/open_data_uploader.rb +5 -0
- data/app/uploaders/decidim/record_image_uploader.rb +2 -2
- data/app/validators/etiquette_validator.rb +0 -7
- data/app/validators/uploader_content_type_validator.rb +4 -2
- data/app/views/decidim/block_user_mailer/notify.html.erb +7 -0
- data/app/views/decidim/devise/confirmations/new.html.erb +1 -1
- data/app/views/decidim/devise/registrations/edit.html.erb +1 -1
- data/app/views/decidim/devise/unlocks/new.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_conversation.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_messages.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_show.html.erb +4 -4
- data/app/views/decidim/newsletter_mailer/newsletter.html.erb +1 -1
- data/app/views/decidim/notifications_settings/show.html.erb +11 -0
- data/app/views/decidim/pages/_standalone.html.erb +3 -1
- data/app/views/decidim/pages/_tabbed.html.erb +1 -1
- data/app/views/decidim/reported_mailer/report.html.erb +8 -8
- data/app/views/decidim/shared/_check_boxes_tree.html.erb +3 -3
- data/app/views/decidim/shared/_component_announcement.html.erb +2 -2
- data/app/views/decidim/shared/participatory_space_filters/_filters.html.erb +1 -1
- data/app/views/decidim/user_report_mailer/notify.html.erb +7 -0
- data/app/views/decidim/widgets/_data_picker.html.erb +1 -1
- data/app/views/layouts/decidim/_application.html.erb +1 -0
- data/app/views/layouts/decidim/_js_configuration.html.erb +1 -1
- data/app/views/layouts/decidim/_main_footer.html.erb +6 -4
- data/app/views/layouts/decidim/_timeout_modal.html.erb +21 -0
- data/config/initializers/active_support.rb +7 -0
- data/config/initializers/devise.rb +1 -1
- data/config/initializers/omniauth.rb +1 -1
- data/config/locales/ar.yml +1 -9
- data/config/locales/bg.yml +1 -15
- data/config/locales/ca.yml +43 -16
- data/config/locales/cs.yml +100 -35
- data/config/locales/de.yml +212 -138
- data/config/locales/el.yml +1 -16
- data/config/locales/en.yml +79 -14
- data/config/locales/eo.yml +0 -1
- data/config/locales/es-MX.yml +31 -16
- data/config/locales/es-PY.yml +30 -15
- data/config/locales/es.yml +30 -15
- data/config/locales/eu.yml +7 -9
- data/config/locales/fi-plain.yml +76 -12
- data/config/locales/fi.yml +82 -18
- data/config/locales/fr-CA.yml +79 -14
- data/config/locales/fr.yml +80 -15
- data/config/locales/gl.yml +1 -9
- data/config/locales/hu.yml +1 -15
- data/config/locales/id-ID.yml +1 -9
- data/config/locales/is-IS.yml +0 -2
- data/config/locales/it.yml +65 -14
- data/config/locales/ja.yml +7 -22
- data/config/locales/lv.yml +3 -15
- data/config/locales/nl.yml +48 -25
- data/config/locales/no.yml +24 -18
- data/config/locales/pl.yml +98 -23
- data/config/locales/pt-BR.yml +1 -9
- data/config/locales/pt.yml +1 -16
- data/config/locales/ro-RO.yml +20 -16
- data/config/locales/ru.yml +1 -10
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +1 -15
- data/config/locales/sr-CS.yml +0 -11
- data/config/locales/sv.yml +6 -17
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/tr-TR.yml +639 -248
- data/config/locales/uk.yml +1 -7
- data/config/locales/zh-CN.yml +1 -16
- data/config/routes.rb +9 -4
- data/db/migrate/20170713131206_add_admin_to_users.rb +1 -1
- data/db/migrate/20180206143340_fix_reference_for_all_resources.rb +2 -0
- data/db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb +2 -2
- data/db/migrate/20200929171508_remove_show_statistics_from_organizations.rb +7 -0
- data/db/migrate/20201010124755_create_decidim_user_moderations.rb +12 -0
- data/db/migrate/20201010124756_create_decidim_user_reports.rb +16 -0
- data/db/migrate/20201010224433_add_suspension_fields_to_decidim_users.rb +8 -0
- data/db/migrate/20201011074641_create_decidim_user_suspensions.rb +14 -0
- data/db/migrate/20201011081626_add_current_suspension_id_to_decidim_users.rb +7 -0
- data/db/migrate/20201013071533_add_reported_content_to_moderations.rb +7 -0
- data/db/migrate/20201019074554_add_locale_to_moderation_reports.rb +7 -0
- data/db/migrate/20201127114444_encrypt_authorization_metadatas.rb +35 -0
- data/db/migrate/20201128130723_add_allow_public_access_to_static_pages.rb +17 -0
- data/db/migrate/20201218144706_update_table_block_user_functionality.rb +8 -0
- data/db/migrate/20201218145252_rename_decidim_user_fields_for_block_functionality.rb +9 -0
- data/db/migrate/20210208134328_add_email_on_moderations_to_users.rb +7 -0
- data/db/seeds.rb +18 -12
- data/lib/decidim/amendable.rb +3 -2
- data/{app/functions/decidim/core → lib/decidim/api/functions}/component_finder_base.rb +1 -1
- data/{app/functions/decidim/core → lib/decidim/api/functions}/component_list.rb +4 -4
- data/{app/functions/decidim/core → lib/decidim/api/functions}/component_list_base.rb +3 -1
- data/lib/decidim/api/functions/needs_api_default_order.rb +24 -0
- data/{app/functions/decidim/core → lib/decidim/api/functions}/needs_api_filter_and_order.rb +0 -0
- data/{app/functions/decidim/core → lib/decidim/api/functions}/participatory_space_finder_base.rb +2 -2
- data/{app/functions/decidim/core → lib/decidim/api/functions}/participatory_space_list_base.rb +3 -1
- data/{app/functions/decidim/core → lib/decidim/api/functions}/user_entity_finder.rb +1 -4
- data/{app/functions/decidim/core → lib/decidim/api/functions}/user_entity_list.rb +1 -3
- data/{app/types/decidim/core → lib/decidim/api/input_filters}/base_input_filter.rb +0 -0
- data/{app/types/decidim/core → lib/decidim/api/input_filters}/component_input_filter.rb +20 -22
- data/{app/types/decidim/core → lib/decidim/api/input_filters}/has_hastaggable_input_filter.rb +1 -1
- data/{app/types/decidim/core → lib/decidim/api/input_filters}/has_localized_input_filter.rb +3 -3
- data/{app/types/decidim/core → lib/decidim/api/input_filters}/has_publishable_input_filter.rb +6 -6
- data/{app/types/decidim/core → lib/decidim/api/input_filters}/has_timestamp_input_filter.rb +12 -12
- data/{app/types/decidim/core → lib/decidim/api/input_filters}/participatory_space_input_filter.rb +0 -1
- data/lib/decidim/api/input_filters/user_entity_input_filter.rb +89 -0
- data/{app/types/decidim/core → lib/decidim/api/input_sorts}/base_input_sort.rb +3 -2
- data/{app/types/decidim/core → lib/decidim/api/input_sorts}/component_input_sort.rb +10 -11
- data/{app/types/decidim/core → lib/decidim/api/input_sorts}/has_endorsable_input_sort.rb +2 -4
- data/{app/types/decidim/core → lib/decidim/api/input_sorts}/has_localized_input_sort.rb +3 -3
- data/{app/types/decidim/core → lib/decidim/api/input_sorts}/has_publishable_input_sort.rb +1 -1
- data/lib/decidim/api/input_sorts/has_timestamp_input_sort.rb +12 -0
- data/{app/types/decidim/core → lib/decidim/api/input_sorts}/participatory_space_input_sort.rb +1 -1
- data/{app/types/decidim/core → lib/decidim/api/input_sorts}/user_entity_input_sort.rb +4 -4
- data/lib/decidim/api/{amendable_entity_interface.rb → interfaces/amendable_entity_interface.rb} +5 -5
- data/lib/decidim/api/interfaces/amendable_interface.rb +17 -0
- data/lib/decidim/api/{attachable_interface.rb → interfaces/attachable_interface.rb} +3 -3
- data/lib/decidim/api/interfaces/author_interface.rb +32 -0
- data/lib/decidim/api/interfaces/authorable_interface.rb +23 -0
- data/lib/decidim/api/{categorizable_interface.rb → interfaces/categorizable_interface.rb} +3 -3
- data/lib/decidim/api/interfaces/coauthorable_interface.rb +30 -0
- data/lib/decidim/api/interfaces/component_interface.rb +22 -0
- data/lib/decidim/api/interfaces/endorsable_interface.rb +19 -0
- data/lib/decidim/api/{fingerprint_interface.rb → interfaces/fingerprint_interface.rb} +3 -3
- data/lib/decidim/api/interfaces/participatory_space_interface.rb +48 -0
- data/lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb +25 -0
- data/lib/decidim/api/{scopable_interface.rb → interfaces/scopable_interface.rb} +3 -3
- data/lib/decidim/api/interfaces/timestamps_interface.rb +15 -0
- data/lib/decidim/api/interfaces/traceable_interface.rb +14 -0
- data/lib/decidim/api/scalars/date_time_type.rb +17 -0
- data/lib/decidim/api/scalars/date_type.rb +17 -0
- data/lib/decidim/api/types/amendment_type.rb +19 -0
- data/lib/decidim/api/types/area_api_type.rb +16 -0
- data/lib/decidim/api/types/area_type_type.rb +13 -0
- data/lib/decidim/api/types/attachment_type.rb +13 -0
- data/lib/decidim/api/types/category_type.rb +14 -0
- data/{app/types/decidim/core → lib/decidim/api/types}/component_type.rb +2 -4
- data/lib/decidim/api/types/coordinates_type.rb +21 -0
- data/lib/decidim/api/types/decidim_type.rb +13 -0
- data/lib/decidim/api/types/fingerprint_type.rb +12 -0
- data/lib/decidim/api/types/hashtag_type.rb +13 -0
- data/lib/decidim/api/types/localized_string_type.rb +13 -0
- data/lib/decidim/api/types/metric_history_type.rb +18 -0
- data/lib/decidim/api/types/metric_type.rb +13 -0
- data/lib/decidim/api/types/organization_type.rb +17 -0
- data/lib/decidim/api/types/participatory_space_link_type.rb +22 -0
- data/lib/decidim/api/types/participatory_space_type.rb +10 -0
- data/lib/decidim/api/types/scope_api_type.rb +16 -0
- data/lib/decidim/api/types/session_type.rb +22 -0
- data/lib/decidim/api/types/statistic_type.rb +20 -0
- data/lib/decidim/api/types/trace_version_type.rb +21 -0
- data/lib/decidim/api/types/translated_field_type.rb +36 -0
- data/lib/decidim/api/types/user_group_type.rb +64 -0
- data/lib/decidim/api/types/user_type.rb +67 -0
- data/lib/decidim/attachment_attributes.rb +57 -0
- data/lib/decidim/attributes.rb +1 -0
- data/lib/decidim/attributes/clean_string.rb +37 -0
- data/lib/decidim/coauthorable.rb +3 -3
- data/lib/decidim/component_manifest.rb +17 -0
- data/lib/decidim/content_block_manifest.rb +1 -1
- data/lib/decidim/content_parsers/hashtag_parser.rb +3 -6
- data/lib/decidim/content_parsers/user_group_parser.rb +2 -5
- data/lib/decidim/content_parsers/user_parser.rb +2 -5
- data/lib/decidim/content_processor.rb +1 -1
- data/lib/decidim/content_renderers/hashtag_renderer.rb +3 -6
- data/lib/decidim/core.rb +11 -3
- data/lib/decidim/core/api.rb +71 -16
- data/lib/decidim/core/engine.rb +40 -6
- data/lib/decidim/core/test.rb +4 -0
- data/lib/decidim/core/test/factories.rb +53 -15
- data/lib/decidim/core/test/shared_examples/admin_log_presenter_examples.rb +34 -0
- data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/amendable/amendment_accepted_event_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +11 -9
- data/lib/decidim/core/test/shared_examples/component_type.rb +1 -1
- data/lib/decidim/core/test/shared_examples/controller_render_views.rb +28 -0
- data/lib/decidim/core/test/shared_examples/counts_commentators_as_newsletter_participants.rb +31 -0
- data/lib/decidim/core/test/shared_examples/follows_examples.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 +1 -1
- data/lib/decidim/core/test/shared_examples/process_announcements_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/reportable.rb +8 -0
- data/lib/decidim/core/test/shared_examples/rich_text_editor_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/searchable_participatory_space_examples.rb +2 -3
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +46 -0
- data/lib/decidim/core/test/shared_examples/static_pages_examples.rb +43 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/diffy_extension.rb +2 -2
- data/lib/decidim/events/base_event.rb +18 -2
- data/lib/decidim/exporters/csv.rb +3 -2
- data/lib/decidim/exporters/export_data.rb +1 -1
- data/lib/decidim/faker/internet.rb +17 -0
- data/lib/decidim/faker/localized.rb +43 -20
- data/lib/decidim/file_validator_humanizer.rb +6 -4
- data/lib/decidim/form_builder.rb +36 -24
- data/lib/decidim/gamification/badge_scorer.rb +3 -2
- data/lib/decidim/gamification/base_event.rb +2 -2
- data/lib/decidim/geocodable.rb +2 -0
- data/lib/decidim/has_category.rb +1 -1
- data/lib/decidim/has_private_users.rb +2 -2
- data/lib/decidim/importers/import_manifest.rb +36 -0
- data/lib/decidim/map/autocomplete.rb +11 -1
- data/lib/decidim/metric_operation.rb +5 -6
- data/lib/decidim/newsletter_participant.rb +2 -4
- data/lib/decidim/paddable.rb +11 -4
- data/lib/decidim/participatory_space_resourceable.rb +1 -3
- data/lib/decidim/query_extensions.rb +90 -69
- data/lib/decidim/randomable.rb +6 -1
- data/lib/decidim/record_encryptor.rb +131 -0
- data/lib/decidim/reportable.rb +26 -0
- data/lib/decidim/resource_manifest.rb +3 -0
- data/lib/decidim/resourceable.rb +6 -6
- data/lib/decidim/scopable.rb +1 -1
- data/lib/decidim/search_resource_fields_mapper.rb +3 -3
- data/lib/decidim/searchable.rb +11 -0
- data/lib/decidim/settings_manifest.rb +2 -1
- data/lib/decidim/shareable_with_token.rb +0 -1
- data/lib/decidim/translatable_attributes.rb +2 -1
- data/lib/decidim/translatable_resource.rb +10 -0
- data/lib/decidim/user_reportable.rb +33 -0
- data/lib/decidim/view_model.rb +26 -0
- data/lib/premailer/adapter/decidim.rb +33 -0
- data/lib/tasks/decidim_data_portability_tasks.rake +4 -4
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ko.js +18 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.vi.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.zh-CN.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.zh-TW.js +14 -0
- metadata +203 -105
- data/app/cells/decidim/tos_page/sticky_form.erb +0 -29
- data/app/functions/decidim/core/participatory_space_finder.rb +0 -11
- data/app/functions/decidim/core/participatory_space_list.rb +0 -11
- data/app/types/decidim/core/amendment_type.rb +0 -26
- data/app/types/decidim/core/area_api_type.rb +0 -16
- data/app/types/decidim/core/area_type_type.rb +0 -14
- data/app/types/decidim/core/attachment_type.rb +0 -14
- data/app/types/decidim/core/category_type.rb +0 -16
- data/app/types/decidim/core/coordinates_type.rb +0 -19
- data/app/types/decidim/core/date_time_type.rb +0 -12
- data/app/types/decidim/core/date_type.rb +0 -13
- data/app/types/decidim/core/decidim_type.rb +0 -19
- data/app/types/decidim/core/fingerprint_type.rb +0 -15
- data/app/types/decidim/core/has_timestamp_input_sort.rb +0 -12
- data/app/types/decidim/core/hashtag_type.rb +0 -13
- data/app/types/decidim/core/localized_string_type.rb +0 -14
- data/app/types/decidim/core/metric_history_type.rb +0 -17
- data/app/types/decidim/core/metric_type.rb +0 -14
- data/app/types/decidim/core/organization_type.rb +0 -20
- data/app/types/decidim/core/participatory_space_link_type.rb +0 -24
- data/app/types/decidim/core/participatory_space_type.rb +0 -12
- data/app/types/decidim/core/scope_api_type.rb +0 -16
- data/app/types/decidim/core/session_type.rb +0 -19
- data/app/types/decidim/core/statistic_type.rb +0 -22
- data/app/types/decidim/core/trace_version_type.rb +0 -29
- data/app/types/decidim/core/translated_field_type.rb +0 -45
- data/app/types/decidim/core/user_entity_input_filter.rb +0 -81
- data/app/types/decidim/core/user_group_type.rb +0 -51
- data/app/types/decidim/core/user_type.rb +0 -52
- data/app/views/decidim/shared/_announcement.html.erb +0 -1
- data/app/views/decidim/shared/_flag_modal.html.erb +0 -20
- data/lib/decidim/api/amendable_interface.rb +0 -18
- data/lib/decidim/api/author_interface.rb +0 -29
- data/lib/decidim/api/authorable_interface.rb +0 -22
- data/lib/decidim/api/coauthorable_interface.rb +0 -29
- data/lib/decidim/api/component_interface.rb +0 -20
- data/lib/decidim/api/endorsable_interface.rb +0 -22
- data/lib/decidim/api/participatory_space_interface.rb +0 -47
- data/lib/decidim/api/participatory_space_resourceable_interface.rb +0 -21
- data/lib/decidim/api/timestamps_interface.rb +0 -21
- data/lib/decidim/api/traceable_interface.rb +0 -14
@@ -4,12 +4,12 @@ module Decidim
|
|
4
4
|
class ExportJob < ApplicationJob
|
5
5
|
queue_as :default
|
6
6
|
|
7
|
-
def perform(user, component, name, format)
|
7
|
+
def perform(user, component, name, format, resource_id = nil)
|
8
8
|
export_manifest = component.manifest.export_manifests.find do |manifest|
|
9
9
|
manifest.name == name.to_sym
|
10
10
|
end
|
11
11
|
|
12
|
-
collection = export_manifest.collection.call(component, user)
|
12
|
+
collection = export_manifest.collection.call(component, user, resource_id)
|
13
13
|
serializer = export_manifest.serializer
|
14
14
|
|
15
15
|
export_data = Decidim::Exporters.find_exporter(format).new(collection, serializer).export
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# Update search indexes for each descendants of a given element
|
5
|
+
class FindAndUpdateDescendantsJob < ApplicationJob
|
6
|
+
queue_as :default
|
7
|
+
|
8
|
+
def perform(element)
|
9
|
+
descendants_collector = components_for(element)
|
10
|
+
descendants_collector << element.comments.to_a if element.respond_to?(:comments)
|
11
|
+
|
12
|
+
return if descendants_collector.blank?
|
13
|
+
|
14
|
+
descendants_collector.each do |descendants|
|
15
|
+
next if descendants.blank?
|
16
|
+
|
17
|
+
Decidim::UpdateSearchIndexesJob.perform_later(descendants)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def manifest_name_to_class(name)
|
24
|
+
resource_registry = Decidim.resource_registry.find(name)
|
25
|
+
return if resource_registry.blank?
|
26
|
+
|
27
|
+
resource_registry.model_class_name&.safe_constantize
|
28
|
+
end
|
29
|
+
|
30
|
+
# returns array of components
|
31
|
+
# If element not responds to components, returns empty array
|
32
|
+
def components_for(element)
|
33
|
+
return [] unless element.respond_to?(:components) && !element.components.empty?
|
34
|
+
|
35
|
+
ary = []
|
36
|
+
element.components.each do |component|
|
37
|
+
klass = component.manifest_name == "blogs" ? Decidim::Blogs::Post : manifest_name_to_class(component.manifest_name)
|
38
|
+
|
39
|
+
next if klass.blank?
|
40
|
+
next if klass.column_names.exclude? "decidim_component_id"
|
41
|
+
|
42
|
+
ary << klass.where(component: component).to_a
|
43
|
+
end
|
44
|
+
|
45
|
+
ary
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -8,6 +8,8 @@ module Decidim
|
|
8
8
|
class MachineTranslationResourceJob < ApplicationJob
|
9
9
|
queue_as :default
|
10
10
|
|
11
|
+
# rubocop: disable Metrics/CyclomaticComplexity
|
12
|
+
|
11
13
|
# Performs the job.
|
12
14
|
#
|
13
15
|
# resource - Any kind of `Decidim::TranslatableResource` model instance
|
@@ -46,6 +48,7 @@ module Decidim
|
|
46
48
|
end
|
47
49
|
end
|
48
50
|
end
|
51
|
+
# rubocop: enable Metrics/CyclomaticComplexity
|
49
52
|
|
50
53
|
def default_locale_changed_or_translation_removed(previous_changes, field)
|
51
54
|
default_locale = default_locale(@resource)
|
@@ -28,6 +28,35 @@ module Decidim
|
|
28
28
|
resource.update_column field_name.to_sym, resource[field_name]
|
29
29
|
# rubocop:enable Rails/SkipsModelValidations
|
30
30
|
end
|
31
|
+
|
32
|
+
send_translated_report_notifications(resource) if reported_resource_in_organization_language?(resource, target_locale)
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def send_translated_report_notifications(reportable)
|
38
|
+
reportable.moderation.reports.each do |report|
|
39
|
+
reportable.moderation.participatory_space.moderators.each do |moderator|
|
40
|
+
Decidim::ReportedMailer.report(moderator, report).deliver_later
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def reported_resource_in_organization_language?(resource, target_locale)
|
46
|
+
return unless resource.try(:organization)
|
47
|
+
|
48
|
+
resource_reported?(resource) && target_locale == resource.organization.default_locale && resource_completely_translated?(resource, target_locale)
|
49
|
+
end
|
50
|
+
|
51
|
+
def resource_reported?(resource)
|
52
|
+
resource.class.included_modules.include?(Decidim::Reportable) && resource.reported?
|
53
|
+
end
|
54
|
+
|
55
|
+
def resource_completely_translated?(resource, target_locale)
|
56
|
+
reported_translatable_fields = resource.reported_attributes & resource.class.translatable_fields_list
|
57
|
+
reported_translatable_fields.all? do |field|
|
58
|
+
resource[field]&.dig("machine_translations", target_locale).present?
|
59
|
+
end
|
31
60
|
end
|
32
61
|
end
|
33
62
|
end
|
@@ -10,7 +10,7 @@ module Decidim
|
|
10
10
|
exporter = OpenDataExporter.new(organization, path)
|
11
11
|
raise "Couldn't generate Open Data export" unless exporter.export.positive?
|
12
12
|
|
13
|
-
OpenDataUploader.new.store!(File.open(path, "rb"))
|
13
|
+
OpenDataUploader.new(organization).store!(File.open(path, "rb"))
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -17,6 +17,7 @@ module Decidim
|
|
17
17
|
return if @organization.nil? || @organization.smtp_settings.blank?
|
18
18
|
|
19
19
|
mail.from = @organization.smtp_settings["from"].presence || mail.from
|
20
|
+
mail.reply_to = mail.from || Decidim.config.mailer_reply
|
20
21
|
mail.delivery_method.settings.merge!(
|
21
22
|
address: @organization.smtp_settings["address"],
|
22
23
|
port: @organization.smtp_settings["port"],
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# A custom mailer for Decidim so we can notify users
|
5
|
+
# when their account was blocked
|
6
|
+
class BlockUserMailer < ApplicationMailer
|
7
|
+
def notify(user, justification)
|
8
|
+
@user = user
|
9
|
+
@organization = user.organization
|
10
|
+
@justification = justification
|
11
|
+
mail(
|
12
|
+
to: user.email,
|
13
|
+
subject: I18n.t(
|
14
|
+
"decidim.block_user_mailer.notify.subject",
|
15
|
+
organization_name: @organization.name,
|
16
|
+
justification: @justification
|
17
|
+
)
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -6,16 +6,17 @@ module Decidim
|
|
6
6
|
helper Decidim::ResourceHelper
|
7
7
|
helper Decidim::TranslationsHelper
|
8
8
|
|
9
|
-
helper_method :reported_content_url, :manage_moderations_url, :author_profile_url
|
9
|
+
helper_method :reported_content_url, :report_url, :manage_moderations_url, :author_profile_url, :reported_content_cell
|
10
10
|
|
11
11
|
def report(user, report)
|
12
12
|
with_user(user) do
|
13
13
|
@report = report
|
14
|
+
@reportable = @report.moderation.reportable
|
14
15
|
@participatory_space = @report.moderation.participatory_space
|
15
16
|
@organization = user.organization
|
16
17
|
@user = user
|
17
|
-
@author = @
|
18
|
-
@
|
18
|
+
@author = @reportable.try(:creator_identity) || @reportable.try(:author)
|
19
|
+
@original_language = original_language(@reportable)
|
19
20
|
subject = I18n.t("report.subject", scope: "decidim.reported_mailer")
|
20
21
|
mail(to: user.email, subject: subject)
|
21
22
|
end
|
@@ -32,12 +33,21 @@ module Decidim
|
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
36
|
+
# See comment for reported_content_cell
|
37
|
+
def current_organization
|
38
|
+
@organization
|
39
|
+
end
|
40
|
+
|
35
41
|
private
|
36
42
|
|
37
43
|
def reported_content_url
|
38
44
|
@reported_content_url ||= @report.moderation.reportable.reported_content_url
|
39
45
|
end
|
40
46
|
|
47
|
+
def report_url
|
48
|
+
@report_url ||= EngineRouter.admin_proxy(@participatory_space).moderation_report_url(host: @organization.host, moderation_id: @report.moderation.id, id: @report.id)
|
49
|
+
end
|
50
|
+
|
41
51
|
def manage_moderations_url
|
42
52
|
@manage_moderations_url ||= EngineRouter.admin_proxy(@participatory_space).moderations_url(host: @organization.host)
|
43
53
|
end
|
@@ -45,5 +55,25 @@ module Decidim
|
|
45
55
|
def author_profile_url
|
46
56
|
@author_profile_url ||= @author.is_a?(Decidim::UserBaseEntity) ? decidim.profile_url(@author.nickname, host: @organization.host) : nil
|
47
57
|
end
|
58
|
+
|
59
|
+
def original_language(reportable)
|
60
|
+
return reportable.content_original_language if reportable.respond_to?(:content_original_language)
|
61
|
+
|
62
|
+
@organization.default_locale
|
63
|
+
end
|
64
|
+
|
65
|
+
# This is needed to be able to use a cell in an ActionMailer, which is not supported out of the box by cells-rails.
|
66
|
+
# We're are passing the current object as if it was a controller.
|
67
|
+
# We also need to define a 'current_organization' method, which is expected by Decidim::ViewModel.
|
68
|
+
# A similar approach is used in Decidim::NewsletterMailer
|
69
|
+
def reported_content_cell
|
70
|
+
@reported_content_cell ||= ::Decidim::ViewModel.cell(
|
71
|
+
"decidim/reported_content",
|
72
|
+
@reportable,
|
73
|
+
context: {
|
74
|
+
controller: self
|
75
|
+
}
|
76
|
+
)
|
77
|
+
end
|
48
78
|
end
|
49
79
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# A custom mailer to notify Decidim users
|
5
|
+
# that they have been reported
|
6
|
+
class UserReportMailer < ApplicationMailer
|
7
|
+
def notify(admin, token, reason, user)
|
8
|
+
@user = user
|
9
|
+
@organization = user.organization
|
10
|
+
@token = token
|
11
|
+
@reason = reason
|
12
|
+
@admin = admin
|
13
|
+
mail(to: admin.email, subject: I18n.t(
|
14
|
+
"decidim.user_report_mailer.notify.subject",
|
15
|
+
organization_name: @organization.name,
|
16
|
+
reason: @reason,
|
17
|
+
token: @token
|
18
|
+
))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/app/models/decidim/area.rb
CHANGED
@@ -13,7 +13,7 @@ module Decidim
|
|
13
13
|
class_name: "Decidim::Organization",
|
14
14
|
inverse_of: :area_types
|
15
15
|
|
16
|
-
has_many :areas,
|
16
|
+
has_many :areas, class_name: "Decidim::Area", inverse_of: :area_type, dependent: :nullify
|
17
17
|
|
18
18
|
validates :name, presence: true
|
19
19
|
|
@@ -11,10 +11,11 @@ module Decidim
|
|
11
11
|
belongs_to :attachment_collection, class_name: "Decidim::AttachmentCollection", optional: true
|
12
12
|
belongs_to :attached_to, polymorphic: true
|
13
13
|
|
14
|
-
validates :file, :content_type, presence: true
|
15
|
-
validates_upload :file
|
16
14
|
mount_uploader :file, Decidim::AttachmentUploader
|
17
15
|
|
16
|
+
validates_upload :file
|
17
|
+
validates :file, :content_type, presence: true
|
18
|
+
|
18
19
|
default_scope { order(arel_table[:weight].asc, arel_table[:id].asc) }
|
19
20
|
|
20
21
|
# Returns the organization related to this attachment in case the
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
|
9
9
|
translatable_fields :name, :description
|
10
10
|
belongs_to :collection_for, polymorphic: true
|
11
|
-
has_many :attachments,
|
11
|
+
has_many :attachments, class_name: "Decidim::Attachment", dependent: :nullify
|
12
12
|
|
13
13
|
default_scope { order(arel_table[:weight].asc) }
|
14
14
|
|
@@ -13,6 +13,10 @@ module Decidim
|
|
13
13
|
class Authorization < ApplicationRecord
|
14
14
|
include Decidim::Traceable
|
15
15
|
include Decidim::HasUploadValidations
|
16
|
+
include Decidim::RecordEncryptor
|
17
|
+
|
18
|
+
encrypt_attribute :metadata, type: :hash
|
19
|
+
encrypt_attribute :verification_metadata, type: :hash
|
16
20
|
|
17
21
|
validates_upload :verification_attachment
|
18
22
|
mount_uploader :verification_attachment, Decidim::Verifications::AttachmentUploader
|
@@ -10,7 +10,7 @@ module Decidim
|
|
10
10
|
|
11
11
|
belongs_to :participatory_space, foreign_key: "decidim_participatory_space_id", foreign_type: "decidim_participatory_space_type", polymorphic: true
|
12
12
|
has_many :subcategories, foreign_key: "parent_id", class_name: "Decidim::Category", dependent: :destroy, inverse_of: :parent
|
13
|
-
belongs_to :parent, class_name: "Decidim::Category",
|
13
|
+
belongs_to :parent, class_name: "Decidim::Category", inverse_of: :subcategories, optional: true
|
14
14
|
has_many :categorizations, foreign_key: "decidim_category_id", class_name: "Decidim::Categorization", dependent: :destroy
|
15
15
|
|
16
16
|
default_scope { order(arel_table[:parent_id].asc, arel_table[:weight].asc) }
|
@@ -38,6 +38,11 @@ module Decidim
|
|
38
38
|
categorizations.empty?
|
39
39
|
end
|
40
40
|
|
41
|
+
# Allow ransacker to search for a key in a hstore column (`name`.`en`)
|
42
|
+
ransacker :name do |parent|
|
43
|
+
Arel::Nodes::InfixOperation.new("->>", parent.table[:name], Arel::Nodes.build_quoted(I18n.locale.to_s))
|
44
|
+
end
|
45
|
+
|
41
46
|
private
|
42
47
|
|
43
48
|
# This is done since we only allow one level of subcategories.
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
belongs_to :admin, foreign_key: "decidim_admin_id", class_name: "Decidim::User"
|
9
9
|
belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User"
|
10
10
|
|
11
|
-
validate :same_organization
|
11
|
+
validate :same_organization
|
12
12
|
|
13
13
|
scope :active, -> { where(ended_at: nil, expired_at: nil) }
|
14
14
|
scope :expired, -> { where(ended_at: nil).where.not(expired_at: nil) }
|
@@ -21,6 +21,10 @@ module Decidim
|
|
21
21
|
expired_at.present?
|
22
22
|
end
|
23
23
|
|
24
|
+
def self.log_presenter_class_for(_log)
|
25
|
+
Decidim::AdminLog::ImpersonationLogPresenter
|
26
|
+
end
|
27
|
+
|
24
28
|
private
|
25
29
|
|
26
30
|
def same_organization
|
@@ -28,11 +32,5 @@ module Decidim
|
|
28
32
|
|
29
33
|
errors.add(:admin, :invalid)
|
30
34
|
end
|
31
|
-
|
32
|
-
def non_active_impersonation
|
33
|
-
return if ended? || expired?
|
34
|
-
|
35
|
-
errors.add(:admin, :invalid) if Decidim::ImpersonationLog.where(admin: admin).active.any?
|
36
|
-
end
|
37
35
|
end
|
38
36
|
end
|
@@ -6,8 +6,8 @@ module Decidim
|
|
6
6
|
# ParticipatorySpace, RelatedObject and Category are optional relationships because not all metric objects need them
|
7
7
|
# For example, User is only related to an organization, but a Proposal can have all of them
|
8
8
|
belongs_to :organization, foreign_key: "decidim_organization_id", class_name: "Decidim::Organization"
|
9
|
-
belongs_to :participatory_space,
|
10
|
-
belongs_to :related_object,
|
9
|
+
belongs_to :participatory_space, foreign_type: "participatory_space_type", polymorphic: true, optional: true
|
10
|
+
belongs_to :related_object, foreign_type: "related_object_type", polymorphic: true, optional: true
|
11
11
|
belongs_to :category, foreign_key: "decidim_category_id", class_name: "Decidim::Category", optional: true
|
12
12
|
|
13
13
|
validates :day, uniqueness: { scope:
|
@@ -15,5 +15,17 @@ module Decidim
|
|
15
15
|
def self.log_presenter_class_for(_log)
|
16
16
|
Decidim::AdminLog::ModerationPresenter
|
17
17
|
end
|
18
|
+
|
19
|
+
ransacker :reported_id_string do
|
20
|
+
Arel.sql(%{cast("decidim_moderations"."decidim_reportable_id" as text)})
|
21
|
+
end
|
22
|
+
|
23
|
+
ransacker :reported_content do
|
24
|
+
Arel.sql(%{cast("decidim_moderations"."reported_content" as text)})
|
25
|
+
end
|
26
|
+
|
27
|
+
ransacker :reportable_type_string do
|
28
|
+
Arel.sql(%{cast("decidim_moderations"."decidim_reportable_type" as text)})
|
29
|
+
end
|
18
30
|
end
|
19
31
|
end
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
:admin_terms_of_use_body
|
22
22
|
|
23
23
|
has_many :static_pages, foreign_key: "decidim_organization_id", class_name: "Decidim::StaticPage", inverse_of: :organization, dependent: :destroy
|
24
|
-
has_many :static_page_topics,
|
24
|
+
has_many :static_page_topics, class_name: "Decidim::StaticPageTopic", inverse_of: :organization, dependent: :destroy
|
25
25
|
has_many :scopes, -> { order(name: :asc) }, foreign_key: "decidim_organization_id", class_name: "Decidim::Scope", inverse_of: :organization
|
26
26
|
has_many :scope_types, -> { order(name: :asc) }, foreign_key: "decidim_organization_id", class_name: "Decidim::ScopeType", inverse_of: :organization
|
27
27
|
has_many :areas, -> { order(name: :asc) }, foreign_key: "decidim_organization_id", class_name: "Decidim::Area", inverse_of: :organization
|
@@ -122,7 +122,7 @@ module Decidim
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def open_data_file
|
125
|
-
@open_data_file ||= OpenDataUploader.new.tap do |uploader|
|
125
|
+
@open_data_file ||= OpenDataUploader.new(self).tap do |uploader|
|
126
126
|
uploader.retrieve_from_store! open_data_file_path
|
127
127
|
uploader.cache! open_data_file_path
|
128
128
|
end
|
@@ -153,6 +153,10 @@ module Decidim
|
|
153
153
|
Decidim::Debates::OfficialAuthorPresenter.new
|
154
154
|
end
|
155
155
|
|
156
|
+
def static_pages_accessible_for(user)
|
157
|
+
static_pages.accessible_for(self, user)
|
158
|
+
end
|
159
|
+
|
156
160
|
private
|
157
161
|
|
158
162
|
def tenant_disabled_providers_keys
|