decidim-core 0.23.6 → 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/core/bundle.js +1 -1
- data/app/assets/javascripts/decidim/core/bundle.js.map +1 -1
- 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/editor.js.es6 +15 -4
- 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/javascripts/decidim.js.es6 +1 -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/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/show.erb +1 -1
- data/app/cells/decidim/activity_cell.rb +11 -14
- data/app/cells/decidim/address/details.erb +5 -5
- data/app/cells/decidim/address_cell.rb +0 -21
- 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/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 -1
- data/app/cells/decidim/tos_page/form.erb +15 -13
- 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/create_report.rb +11 -1
- data/app/commands/decidim/create_user_report.rb +67 -0
- data/app/commands/decidim/destroy_account.rb +0 -2
- 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 -1
- 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 +2 -2
- 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 -3
- 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/scopes_helper.rb +1 -1
- data/app/jobs/decidim/block_user_job.rb +11 -0
- 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/update_search_indexes_job.rb +11 -0
- data/app/jobs/decidim/user_report_job.rb +11 -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 +5 -1
- 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 +13 -8
- data/app/models/decidim/user_base_entity.rb +13 -13
- data/app/models/decidim/user_block.rb +10 -0
- data/app/models/decidim/user_group.rb +1 -4
- 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/impersonation_log_presenter.rb +39 -0
- data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -2
- data/app/presenters/decidim/admin_log/user_moderation_presenter.rb +63 -0
- data/app/presenters/decidim/admin_log/user_presenter.rb +18 -9
- data/app/presenters/decidim/home_stats_presenter.rb +3 -3
- 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/queries/decidim/user_groups/accepted_memberships.rb +1 -1
- data/app/queries/decidim/user_groups/admin_memberships.rb +1 -1
- data/app/queries/decidim/user_groups/member_memberships.rb +1 -1
- 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/zip_stream/zip_stream_writer.rb +3 -3
- data/app/uploaders/decidim/application_uploader.rb +22 -2
- 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/application/_document.html.erb +1 -1
- 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/notifications_settings/show.html.erb +11 -0
- data/app/views/decidim/pages/_standalone.html.erb +3 -1
- data/app/views/decidim/reported_mailer/report.html.erb +9 -17
- 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 -7
- data/config/locales/bg.yml +1 -13
- data/config/locales/ca.yml +46 -17
- data/config/locales/cs.yml +118 -53
- data/config/locales/de.yml +83 -18
- data/config/locales/el.yml +1 -14
- data/config/locales/en.yml +79 -14
- data/config/locales/eo.yml +0 -1
- data/config/locales/es-MX.yml +31 -14
- data/config/locales/es-PY.yml +31 -14
- data/config/locales/es.yml +34 -17
- data/config/locales/eu.yml +4 -10
- data/config/locales/fi-plain.yml +80 -16
- data/config/locales/fi.yml +85 -21
- data/config/locales/fr-CA.yml +79 -14
- data/config/locales/fr.yml +76 -11
- data/config/locales/gl.yml +1 -15
- data/config/locales/hu.yml +1 -12
- data/config/locales/id-ID.yml +1 -7
- data/config/locales/is-IS.yml +0 -9
- data/config/locales/it.yml +72 -19
- data/config/locales/ja.yml +1 -14
- data/config/locales/lv.yml +1 -12
- data/config/locales/nl.yml +38 -13
- data/config/locales/no.yml +7 -14
- data/config/locales/pl.yml +81 -14
- data/config/locales/pt-BR.yml +1 -7
- data/config/locales/pt.yml +1 -14
- data/config/locales/ro-RO.yml +15 -25
- data/config/locales/ru.yml +7 -12
- data/config/locales/sk.yml +2 -13
- data/config/locales/sr-CS.yml +0 -9
- data/config/locales/sv.yml +5 -27
- data/config/locales/tr-TR.yml +65 -14
- data/config/locales/uk.yml +7 -9
- data/config/locales/zh-CN.yml +1 -14
- 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 +14 -13
- 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/clean_string.rb +37 -0
- data/lib/decidim/attributes.rb +1 -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/api.rb +71 -16
- data/lib/decidim/core/engine.rb +35 -6
- data/lib/decidim/core/test/factories.rb +53 -15
- 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/categorizable_interface_examples.rb +6 -14
- 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/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/test.rb +2 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +11 -3
- data/lib/decidim/diffy_extension.rb +2 -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 +33 -22
- 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 +1 -1
- 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/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 +1 -1
- data/lib/decidim/searchable.rb +9 -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 +4 -4
- 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 +190 -95
- data/app/functions/decidim/core/participatory_space_finder.rb +0 -11
- data/app/functions/decidim/core/participatory_space_list.rb +0 -11
- data/app/helpers/decidim/cache_helper.rb +0 -14
- 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/db/migrate/20210302150803_invalidate_all_sessions_for_deleted_users.rb +0 -11
- 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
data/config/locales/uk.yml
CHANGED
@@ -48,7 +48,6 @@ uk:
|
|
48
48
|
file_no_exists: Файл не існує
|
49
49
|
notice: Зараз відбувається збереження у вигляді файлу. Ви отримаєте електронного листа після його завершення.
|
50
50
|
delete:
|
51
|
-
alert: Цю дію скасувати не можна. Якщо ви видалите свій обліковий запис, ви не зможете ввійти в систему.
|
52
51
|
confirm:
|
53
52
|
close: Закрити вікно
|
54
53
|
ok: Так, я хочу видалити свій обліковий запис
|
@@ -215,7 +214,6 @@ uk:
|
|
215
214
|
ready: Готово
|
216
215
|
show:
|
217
216
|
download_data: Завантажити дані
|
218
|
-
download_data_description: Файл із усіма відомостями, пов'язаними з обліковим записом, буде відправлений на <strong>%{user_email}</strong>
|
219
217
|
request_data: Подати запит на дані
|
220
218
|
devise:
|
221
219
|
omniauth_registrations:
|
@@ -307,7 +305,6 @@ uk:
|
|
307
305
|
notification_title: Сторінка <a href="%{resource_path}">профілю</a> учасника %{name} (%{nickname}), за яким ви стежите, була оновлена.
|
308
306
|
export_mailer:
|
309
307
|
data_portability_export:
|
310
|
-
click_button: 'Натисніть наступну кнопку, щоб завантажити свої дані. <br/> Ваш файл буде доступним до %{date}.'
|
311
308
|
download: Завантажити
|
312
309
|
export:
|
313
310
|
ready: Нижче додається стиснута в архів версія вашого збереженого файлу.
|
@@ -458,14 +455,16 @@ uk:
|
|
458
455
|
debates_count: Обговорення
|
459
456
|
endorsements_count: Проявів підтримки
|
460
457
|
headline: Поточний стан %{organization}
|
461
|
-
meetings_count:
|
458
|
+
meetings_count: Зустрічей
|
462
459
|
orders_count: Голосів
|
460
|
+
pages_count: Сторінок
|
463
461
|
processes_count: Рухів
|
464
|
-
projects_count:
|
462
|
+
projects_count: Проектів
|
465
463
|
proposals_accepted: Прийняті пропозиції
|
466
|
-
proposals_count:
|
467
|
-
results_count:
|
464
|
+
proposals_count: Пропозицій
|
465
|
+
results_count: Підсумків
|
468
466
|
surveys_count: Опитувань
|
467
|
+
users_count: Учасників
|
469
468
|
votes_count: Голосів
|
470
469
|
sub_hero:
|
471
470
|
register: Зареєструватися
|
@@ -506,7 +505,6 @@ uk:
|
|
506
505
|
subject: Ресурс було автоматично приховано
|
507
506
|
report:
|
508
507
|
hello: Доброго дня, %{name}%!
|
509
|
-
manage_moderations: Керувати діями з модерації
|
510
508
|
report_html: <p>Про наступний <a href="%{url}">вміст</a> було передано скаргу адміністраторам.</p>
|
511
509
|
subject: Про цей ресурс було передано скаргу адміністраторам
|
512
510
|
reports:
|
@@ -603,7 +601,7 @@ uk:
|
|
603
601
|
public: Оприлюднені відомості про вас.
|
604
602
|
errors:
|
605
603
|
messages:
|
606
|
-
|
604
|
+
content_type_allowlist_error: цей тип файлу неприпустимий
|
607
605
|
cycle_detected: батько обсягу не може бути одним з його нащадків
|
608
606
|
file_size_is_less_than_or_equal_to: розмір файлу має бути меншим або рівним %{count}
|
609
607
|
nesting_too_deep: не може бути всередині підкатегорії
|
data/config/locales/zh-CN.yml
CHANGED
@@ -35,7 +35,6 @@ zh-CN:
|
|
35
35
|
decidim/profile_updated_event: 个人资料已更新
|
36
36
|
decidim/promote_to_admin: 晋升到组管理员
|
37
37
|
decidim/removed_from_group: 已从群组删除
|
38
|
-
decidim/resource_endorsed_event: 批准Resurce
|
39
38
|
activerecord:
|
40
39
|
attributes:
|
41
40
|
decidim/user:
|
@@ -77,7 +76,6 @@ zh-CN:
|
|
77
76
|
file_no_exists: 文件不存在
|
78
77
|
notice: 目前正在下载您的数据。完成后,您将收到一封电子邮件。
|
79
78
|
delete:
|
80
|
-
alert: 此操作无法撤销。如果您删除您的帐户,您将无法登录。
|
81
79
|
confirm:
|
82
80
|
close: 关闭窗口
|
83
81
|
ok: 是,我想要删除我的帐户
|
@@ -123,7 +121,6 @@ zh-CN:
|
|
123
121
|
update: "%{user_name} 更新了组织设置"
|
124
122
|
participatory_space_private_user:
|
125
123
|
create: "%{user_name} 邀請了 %{resource_name} 作为私人参与者"
|
126
|
-
create_via_csv: "%{user_name} 通过 csv 邀请 %{resource_name} 成为私人参与者"
|
127
124
|
delete: "%{user_name} 移除了参与者 %{resource_name} 作为私人参与者"
|
128
125
|
scope:
|
129
126
|
create: "%{user_name} 创建了 %{resource_name} 范围"
|
@@ -380,7 +377,6 @@ zh-CN:
|
|
380
377
|
ready: 准备好
|
381
378
|
show:
|
382
379
|
download_data: 下载数据
|
383
|
-
download_data_description: 包含与该帐户相关联的所有信息的文件将被发送到 <strong>%{user_email}</strong>
|
384
380
|
request_data: 请求数据
|
385
381
|
datepicker:
|
386
382
|
help_text: '预期格式: %{datepicker_format}'
|
@@ -390,7 +386,6 @@ zh-CN:
|
|
390
386
|
email_already_exists: 另一个帐户正在使用相同的电子邮件地址
|
391
387
|
new:
|
392
388
|
complete_profile: 完整资料
|
393
|
-
nickname_help: 您在 %{organization} 中的别名
|
394
389
|
sign_up: 请填写您的个人资料
|
395
390
|
subtitle: 请填写以下表单以完成注册
|
396
391
|
username_help: 在您的帖子上出现的公共名称。为了保证匿名,可以使用任何名称。
|
@@ -399,7 +394,6 @@ zh-CN:
|
|
399
394
|
already_have_an_account?: 已经有一个帐户?
|
400
395
|
newsletter: 接收附带相关信息的时事通讯
|
401
396
|
newsletter_title: 联系人权限
|
402
|
-
nickname_help: 您在 %{organization} 中的别名
|
403
397
|
password_help: "%{minimun_characters} 个字符,必须不要太常见(例如,123456),并且必须不同于您的昵称和电子邮件。"
|
404
398
|
sign_in: 登录
|
405
399
|
sign_up: 注册
|
@@ -591,7 +585,6 @@ zh-CN:
|
|
591
585
|
notification_title: 您关注的 %{name} (%{nickname}) 的 <a href="%{resource_path}">个人资料页面</a> 已经更新。
|
592
586
|
export_mailer:
|
593
587
|
data_portability_export:
|
594
|
-
click_button: '点击下一个按钮下载您的数据。 <br/> 您将有文件直到 %{date}。 <br/> 您将需要 <a href=''https://www.7-zip.org/''>7-Zip</a> 来打开它。密码: %{password}'
|
595
588
|
download: 下载
|
596
589
|
export:
|
597
590
|
ready: 请找到您导出的压缩版本。
|
@@ -623,7 +616,6 @@ zh-CN:
|
|
623
616
|
create:
|
624
617
|
button: 关注
|
625
618
|
error: 关注此资源时出现问题。
|
626
|
-
participatory_space: 已经关注 <span class="show-for-sr">%{resource_name}</span>
|
627
619
|
destroy:
|
628
620
|
button: 停止关注
|
629
621
|
error: 出现了一个不关注此资源的问题。
|
@@ -640,7 +632,6 @@ zh-CN:
|
|
640
632
|
file:
|
641
633
|
explanation: '文件指南:'
|
642
634
|
message_1: 必须是图像或文档。
|
643
|
-
message_2: 对于图像,使用最好的景观图像,服务将图像作为图像。
|
644
635
|
image:
|
645
636
|
explanation: '图像指南:'
|
646
637
|
message_1: 更喜欢一个没有任何文本的横屏图像。
|
@@ -882,7 +873,6 @@ zh-CN:
|
|
882
873
|
show:
|
883
874
|
back: 回到所有对话
|
884
875
|
chat_with: 对话
|
885
|
-
not_allowed: 此用户不接受任何更多的直接消息。
|
886
876
|
title: 与 %{usernames} 的对话
|
887
877
|
start:
|
888
878
|
send: 发送
|
@@ -890,8 +880,6 @@ zh-CN:
|
|
890
880
|
update:
|
891
881
|
error: 消息因错误而未发送
|
892
882
|
metrics:
|
893
|
-
download:
|
894
|
-
csv: 下载数据 (csv)
|
895
883
|
followers:
|
896
884
|
description: 跟随此参与空间的参与者数量
|
897
885
|
object: 关注者
|
@@ -1093,7 +1081,6 @@ zh-CN:
|
|
1093
1081
|
date: 报告于
|
1094
1082
|
details: 详细信息
|
1095
1083
|
hello: 您好 %{name},
|
1096
|
-
manage_moderations: 管理版面
|
1097
1084
|
participatory_space: 参与空间
|
1098
1085
|
reason: 原因
|
1099
1086
|
report_html: <p>以下 <a href="%{url}">内容</a> 已被报告。</p>
|
@@ -1427,7 +1414,7 @@ zh-CN:
|
|
1427
1414
|
messages:
|
1428
1415
|
already_confirmed: 已经确认,请尝试登录
|
1429
1416
|
confirmation_period_expired: 需要在 %{period}内确认, 请申请一个新的
|
1430
|
-
|
1417
|
+
content_type_allowlist_error: 文件类型无效
|
1431
1418
|
cycle_detected: 一个 scope 的父目录不能是它的后代之一。
|
1432
1419
|
expired: 已过期,请申请一个新的
|
1433
1420
|
file_size_is_less_than_or_equal_to: 文件大小必须小于或等于 %{count}
|
data/config/routes.rb
CHANGED
@@ -36,6 +36,7 @@ Decidim::Core::Engine.routes.draw do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
mount Decidim::Verifications::Engine, at: "/", as: "decidim_verifications"
|
39
|
+
mount Decidim::Comments::Engine, at: "/", as: "decidim_comments"
|
39
40
|
|
40
41
|
Decidim.global_engines.each do |name, engine_data|
|
41
42
|
mount engine_data[:engine], at: engine_data[:at], as: name
|
@@ -91,8 +92,8 @@ Decidim::Core::Engine.routes.draw do
|
|
91
92
|
end
|
92
93
|
end
|
93
94
|
|
94
|
-
resources :profiles, only: [:show], param: :nickname, constraints: { nickname: %r{[
|
95
|
-
scope "/profiles/:nickname", format: false, constraints: { nickname: %r{[
|
95
|
+
resources :profiles, only: [:show], param: :nickname, constraints: { nickname: %r{[^/]+} }, format: false
|
96
|
+
scope "/profiles/:nickname", format: false, constraints: { nickname: %r{[^/]+} } do
|
96
97
|
get "following", to: "profiles#following", as: "profile_following"
|
97
98
|
get "followers", to: "profiles#followers", as: "profile_followers"
|
98
99
|
get "badges", to: "profiles#badges", as: "profile_badges"
|
@@ -103,12 +104,15 @@ Decidim::Core::Engine.routes.draw do
|
|
103
104
|
resources :conversations, except: [:destroy], controller: "user_conversations", as: "profile_conversations"
|
104
105
|
end
|
105
106
|
|
107
|
+
scope :timeouts do
|
108
|
+
post "heartbeat", to: "timeouts#heartbeat"
|
109
|
+
get "seconds_until_timeout", to: "timeouts#seconds_until_timeout"
|
110
|
+
end
|
111
|
+
|
106
112
|
resources :pages, only: [:index, :show], format: false
|
107
113
|
|
108
114
|
get "/search", to: "searches#index", as: :search
|
109
115
|
|
110
|
-
get :organization_users, to: "users#index"
|
111
|
-
|
112
116
|
get "/scopes/picker", to: "scopes#picker", as: :scopes_picker
|
113
117
|
|
114
118
|
get "/static_map", to: "static_map#show", as: :static_map
|
@@ -122,6 +126,7 @@ Decidim::Core::Engine.routes.draw do
|
|
122
126
|
|
123
127
|
resource :follow, only: [:create, :destroy]
|
124
128
|
resource :report, only: [:create]
|
129
|
+
resource :report_user, only: [:create]
|
125
130
|
resources :endorsements, only: [:create, :destroy] do
|
126
131
|
get :identities, on: :member
|
127
132
|
end
|
@@ -5,6 +5,8 @@ class FixReferenceForAllResources < ActiveRecord::Migration[5.1]
|
|
5
5
|
models = ActiveRecord::Base.descendants.select { |c| c.included_modules.include?(Decidim::HasReference) }
|
6
6
|
|
7
7
|
models.each do |model|
|
8
|
+
next unless model.table_exists?
|
9
|
+
|
8
10
|
model.find_each(&:touch)
|
9
11
|
end
|
10
12
|
end
|
data/db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
class RenameMaximumVotesPerProposalToThresholdPerProposal < ActiveRecord::Migration[5.1]
|
4
4
|
def up
|
5
|
-
execute <<~SQL
|
5
|
+
execute <<~SQL.squish
|
6
6
|
UPDATE decidim_components
|
7
7
|
SET settings = jsonb_set(
|
8
8
|
settings::jsonb,
|
@@ -14,7 +14,7 @@ class RenameMaximumVotesPerProposalToThresholdPerProposal < ActiveRecord::Migrat
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def down
|
17
|
-
execute <<~SQL
|
17
|
+
execute <<~SQL.squish
|
18
18
|
UPDATE decidim_components
|
19
19
|
SET settings = jsonb_set(
|
20
20
|
settings::jsonb,
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateDecidimUserModerations < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :decidim_user_moderations do |t|
|
6
|
+
t.belongs_to :decidim_user, foreign_key: true
|
7
|
+
t.integer :report_count, default: 0, null: false
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateDecidimUserReports < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :decidim_user_reports do |t|
|
6
|
+
t.integer :user_moderation_id, foreign_key: true
|
7
|
+
t.integer :user_id, null: false
|
8
|
+
t.string :reason
|
9
|
+
t.text :details
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
add_foreign_key :decidim_user_reports, :decidim_user_moderations, column: :user_moderation_id
|
14
|
+
add_foreign_key :decidim_user_reports, :decidim_users, column: :user_id
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateDecidimUserSuspensions < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :decidim_user_suspensions do |t|
|
6
|
+
t.belongs_to :decidim_user, foreign_key: true
|
7
|
+
t.integer :suspending_user_id
|
8
|
+
t.text :justification
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
add_foreign_key :decidim_user_suspensions, :decidim_users, column: :suspending_user_id
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class EncryptAuthorizationMetadatas < ActiveRecord::Migration[5.2]
|
4
|
+
def up
|
5
|
+
Decidim::Authorization.all.each do |auth|
|
6
|
+
# Re-setting these values will internally convert the hash values to
|
7
|
+
# encypted values
|
8
|
+
auth.update!(
|
9
|
+
metadata: auth.metadata,
|
10
|
+
verification_metadata: auth.verification_metadata
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def down
|
16
|
+
Decidim::Authorization.all.each do |auth|
|
17
|
+
# rubocop:disable Rails/SkipsModelValidations
|
18
|
+
auth.update_columns(
|
19
|
+
metadata: decrypt_hash(auth.metadata),
|
20
|
+
verification_metadata: decrypt_hash(auth.verification_metadata)
|
21
|
+
)
|
22
|
+
# rubocop:enable Rails/SkipsModelValidations
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def decrypt_hash(hash)
|
29
|
+
hash.transform_values do |value|
|
30
|
+
ActiveSupport::JSON.decode(Decidim::AttributeEncryptor.decrypt(value))
|
31
|
+
rescue ActiveSupport::MessageEncryptor::InvalidMessage
|
32
|
+
value
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddAllowPublicAccessToStaticPages < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
add_column :decidim_static_pages, :allow_public_access, :boolean, null: false, default: false
|
6
|
+
|
7
|
+
reversible do |direction|
|
8
|
+
direction.up do
|
9
|
+
# rubocop:disable Rails/SkipsModelValidations
|
10
|
+
Decidim::StaticPage.where(slug: "terms-and-conditions").update_all(
|
11
|
+
allow_public_access: true
|
12
|
+
)
|
13
|
+
# rubocop:enable Rails/SkipsModelValidations
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class UpdateTableBlockUserFunctionality < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
rename_column :decidim_user_suspensions, :suspending_user_id, :blocking_user_id
|
6
|
+
rename_table :decidim_user_suspensions, :decidim_user_blocks
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RenameDecidimUserFieldsForBlockFunctionality < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
rename_column :decidim_users, :suspended, :blocked
|
6
|
+
rename_column :decidim_users, :suspended_at, :blocked_at
|
7
|
+
rename_column :decidim_users, :suspension_id, :block_id
|
8
|
+
end
|
9
|
+
end
|
data/db/seeds.rb
CHANGED
@@ -4,6 +4,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
4
4
|
print "Creating seeds for decidim-core...\n" unless Rails.env.test?
|
5
5
|
|
6
6
|
require "decidim/faker/localized"
|
7
|
+
require "decidim/faker/internet"
|
7
8
|
|
8
9
|
seeds_root = File.join(__dir__, "seeds")
|
9
10
|
|
@@ -16,8 +17,8 @@ if !Rails.env.production? || ENV["SEED"]
|
|
16
17
|
table.tr("_", "/").classify.safe_constantize
|
17
18
|
end.compact.each(&:reset_column_information)
|
18
19
|
|
19
|
-
smtp_label = Faker::Twitter.unique.screen_name
|
20
|
-
smtp_email = Faker::Internet.email
|
20
|
+
smtp_label = ENV["SMTP_FROM_LABEL"] || Faker::Twitter.unique.screen_name
|
21
|
+
smtp_email = ENV["SMTP_FROM_EMAIL"] || Faker::Internet.email
|
21
22
|
|
22
23
|
organization = Decidim::Organization.first || Decidim::Organization.create!(
|
23
24
|
name: Faker::Company.name,
|
@@ -30,14 +31,14 @@ if !Rails.env.production? || ENV["SEED"]
|
|
30
31
|
from: "#{smtp_label} <#{smtp_email}>",
|
31
32
|
from_email: smtp_email,
|
32
33
|
from_label: smtp_label,
|
33
|
-
user_name: Faker::Twitter.unique.screen_name,
|
34
|
-
encrypted_password: Decidim::AttributeEncryptor.encrypt(Faker::Internet.password(8)),
|
35
|
-
address: ENV["DECIDIM_HOST"] || "localhost",
|
36
|
-
port: ENV["DECIDIM_SMTP_PORT"] || "25"
|
34
|
+
user_name: ENV["SMTP_USERNAME"] || Faker::Twitter.unique.screen_name,
|
35
|
+
encrypted_password: Decidim::AttributeEncryptor.encrypt(ENV["SMTP_PASSWORD"] || Faker::Internet.password(min_length: 8)),
|
36
|
+
address: ENV["SMTP_ADDRESS"] || ENV["DECIDIM_HOST"] || "localhost",
|
37
|
+
port: ENV["SMTP_PORT"] || ENV["DECIDIM_SMTP_PORT"] || "25"
|
37
38
|
},
|
38
39
|
host: ENV["DECIDIM_HOST"] || "localhost",
|
39
40
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
40
|
-
Decidim::Faker::Localized.sentence(15)
|
41
|
+
Decidim::Faker::Localized.sentence(word_count: 15)
|
41
42
|
end,
|
42
43
|
default_locale: Decidim.default_locale,
|
43
44
|
available_locales: Decidim.available_locales,
|
@@ -75,7 +76,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
75
76
|
5.times do
|
76
77
|
Decidim::Scope.create!(
|
77
78
|
name: Decidim::Faker::Localized.literal(Faker::Address.unique.city),
|
78
|
-
code: parent.code
|
79
|
+
code: "#{parent.code}-#{Faker::Address.unique.state_abbr}",
|
79
80
|
scope_type: municipality,
|
80
81
|
organization: organization,
|
81
82
|
parent: parent
|
@@ -125,7 +126,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
125
126
|
admin: true,
|
126
127
|
tos_agreement: true,
|
127
128
|
personal_url: Faker::Internet.url,
|
128
|
-
about: Faker::Lorem.paragraph(2),
|
129
|
+
about: Faker::Lorem.paragraph(sentence_count: 2),
|
129
130
|
accepted_tos_version: organization.tos_version,
|
130
131
|
admin_terms_accepted_at: Time.current
|
131
132
|
)
|
@@ -142,7 +143,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
142
143
|
organization: organization,
|
143
144
|
tos_agreement: true,
|
144
145
|
personal_url: Faker::Internet.url,
|
145
|
-
about: Faker::Lorem.paragraph(2),
|
146
|
+
about: Faker::Lorem.paragraph(sentence_count: 2),
|
146
147
|
accepted_tos_version: organization.tos_version
|
147
148
|
)
|
148
149
|
|
@@ -158,7 +159,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
158
159
|
organization: organization,
|
159
160
|
tos_agreement: true,
|
160
161
|
personal_url: Faker::Internet.url,
|
161
|
-
about: Faker::Lorem.paragraph(2),
|
162
|
+
about: Faker::Lorem.paragraph(sentence_count: 2),
|
162
163
|
accepted_tos_version: organization.tos_version
|
163
164
|
)
|
164
165
|
|
@@ -178,7 +179,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
178
179
|
email: Faker::Internet.email,
|
179
180
|
confirmed_at: Time.current,
|
180
181
|
extended_data: {
|
181
|
-
document_number: Faker::Number.number(10).to_s,
|
182
|
+
document_number: Faker::Number.number(digits: 10).to_s,
|
182
183
|
phone: Faker::PhoneNumber.phone_number,
|
183
184
|
verified_at: verified_at
|
184
185
|
},
|
@@ -208,7 +209,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
208
209
|
hero_content_block = Decidim::ContentBlock.find_by(organization: organization, manifest_name: :hero, scope_name: :homepage)
|
209
210
|
hero_content_block.images_container.background_image = File.new(File.join(seeds_root, "homepage_image.jpg"))
|
210
211
|
settings = {}
|
211
|
-
welcome_text = Decidim::Faker::Localized.sentence(5)
|
212
|
+
welcome_text = Decidim::Faker::Localized.sentence(word_count: 5)
|
212
213
|
settings = welcome_text.inject(settings) { |acc, (k, v)| acc.update("welcome_text_#{k}" => v) }
|
213
214
|
hero_content_block.settings = settings
|
214
215
|
hero_content_block.save!
|
data/lib/decidim/amendable.rb
CHANGED
@@ -44,7 +44,7 @@ module Decidim
|
|
44
44
|
when "participants"
|
45
45
|
return none unless user
|
46
46
|
|
47
|
-
where(id: joins(:amendable).where(
|
47
|
+
where(id: joins(:amendable).where(decidim_amendments: { decidim_user_id: user.id }))
|
48
48
|
else # Assume 'all'
|
49
49
|
only_emendations
|
50
50
|
end
|
@@ -67,6 +67,7 @@ module Decidim
|
|
67
67
|
|
68
68
|
class_methods do
|
69
69
|
attr_reader :amendable_options
|
70
|
+
|
70
71
|
# Public: Configures amendable for this model.
|
71
72
|
#
|
72
73
|
# fields - An `Array` of `symbols` specifying the fields that can be amended
|
@@ -134,7 +135,7 @@ module Decidim
|
|
134
135
|
when "participants"
|
135
136
|
return self.class.none unless user
|
136
137
|
|
137
|
-
published_emendations.where(
|
138
|
+
published_emendations.where(decidim_amendments: { decidim_user_id: user.id })
|
138
139
|
else # Assume 'all'
|
139
140
|
published_emendations
|
140
141
|
end
|
@@ -14,8 +14,9 @@ module Decidim
|
|
14
14
|
# This is used by ParticipatorySpaceInterface to apply filter/orders when
|
15
15
|
# searching raw components. When listing properly defined components,
|
16
16
|
# use ComponentListBase instead
|
17
|
-
class ComponentList
|
17
|
+
class ComponentList
|
18
18
|
include NeedsApiFilterAndOrder
|
19
|
+
include NeedsApiDefaultOrder
|
19
20
|
attr_reader :model_class
|
20
21
|
|
21
22
|
def initialize
|
@@ -26,11 +27,10 @@ module Decidim
|
|
26
27
|
@query = Decidim::Component
|
27
28
|
# remove default ordering if custom order required
|
28
29
|
@query = @query.unscoped if args[:order]
|
29
|
-
@query = @query.where(
|
30
|
-
participatory_space: participatory_space
|
31
|
-
).published
|
30
|
+
@query = @query.where(participatory_space: participatory_space).published
|
32
31
|
add_filter_keys(args[:filter])
|
33
32
|
add_order_keys(args[:order].to_h)
|
33
|
+
add_default_order
|
34
34
|
@query
|
35
35
|
end
|
36
36
|
end
|
@@ -25,8 +25,9 @@ module Decidim
|
|
25
25
|
# For an example check
|
26
26
|
# decidim-proposals/app/types/decidim/proposals/proposals_type.rb
|
27
27
|
#
|
28
|
-
class ComponentListBase
|
28
|
+
class ComponentListBase
|
29
29
|
include NeedsApiFilterAndOrder
|
30
|
+
include NeedsApiDefaultOrder
|
30
31
|
attr_reader :model_class
|
31
32
|
|
32
33
|
def initialize(model_class:)
|
@@ -40,6 +41,7 @@ module Decidim
|
|
40
41
|
add_filter_keys(args[:filter])
|
41
42
|
order = filter_keys_by_settings(args[:order].to_h, component)
|
42
43
|
add_order_keys(order)
|
44
|
+
add_default_order
|
43
45
|
@query
|
44
46
|
end
|
45
47
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
module NeedsApiDefaultOrder
|
6
|
+
private
|
7
|
+
|
8
|
+
# Add default order to the query in order to avoid random PostgreSQL
|
9
|
+
# ordering between the queries for different pages of results. If some of
|
10
|
+
# the queried records are updated or new records are added between the
|
11
|
+
# API calls to different pages of records, PostgreSQL can randomly change
|
12
|
+
# the order causing duplicates to appear or some records to disappear from
|
13
|
+
# the results unless the order of the records is explicitly defined.
|
14
|
+
#
|
15
|
+
# Note that this needs to be called as the last method before returning
|
16
|
+
# the query so that it won't affect the desired ordering specified in the
|
17
|
+
# GraphQ query. In that case, ordering by ID will be the secondary order
|
18
|
+
# of the records.
|
19
|
+
def add_default_order
|
20
|
+
@query = @query.order(:id)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
File without changes
|
data/{app/functions/decidim/core → lib/decidim/api/functions}/participatory_space_finder_base.rb
RENAMED
@@ -5,7 +5,7 @@ module Decidim
|
|
5
5
|
# An abstract base class resolver for the GraphQL endpoint for a single participatory space
|
6
6
|
# Inherit from this class and add search arguments to create finder participatory classes
|
7
7
|
# as is shown in ParticipatorySpaceFinder
|
8
|
-
class ParticipatorySpaceFinderBase
|
8
|
+
class ParticipatorySpaceFinderBase
|
9
9
|
attr_reader :manifest
|
10
10
|
|
11
11
|
def initialize(manifest:)
|
@@ -19,7 +19,7 @@ module Decidim
|
|
19
19
|
|
20
20
|
def call(_obj, args, ctx)
|
21
21
|
query = { organization: ctx[:current_organization] }
|
22
|
-
args.keys.each do |key|
|
22
|
+
args.compact.keys.each do |key|
|
23
23
|
query[key] = args[key]
|
24
24
|
end
|
25
25
|
model_class.public_spaces.find_by(query)
|
data/{app/functions/decidim/core → lib/decidim/api/functions}/participatory_space_list_base.rb
RENAMED
@@ -7,8 +7,9 @@ module Decidim
|
|
7
7
|
# as is shown in ParticipatorySpaceList
|
8
8
|
# + info:
|
9
9
|
# https://github.com/rmosolgo/graphql-ruby/blob/v1.6.8/guides/fields/function.md
|
10
|
-
class ParticipatorySpaceListBase
|
10
|
+
class ParticipatorySpaceListBase
|
11
11
|
include NeedsApiFilterAndOrder
|
12
|
+
include NeedsApiDefaultOrder
|
12
13
|
attr_reader :manifest
|
13
14
|
|
14
15
|
def initialize(manifest:)
|
@@ -27,6 +28,7 @@ module Decidim
|
|
27
28
|
|
28
29
|
add_filter_keys(args[:filter])
|
29
30
|
add_order_keys(args[:order].to_h)
|
31
|
+
add_default_order
|
30
32
|
@query
|
31
33
|
end
|
32
34
|
end
|