decidim-core 0.23.1 → 0.24.0.rc2
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/show.erb +1 -1
- data/app/cells/decidim/activity_cell.rb +17 -8
- data/app/cells/decidim/address/details.erb +5 -5
- data/app/cells/decidim/address_cell.rb +21 -0
- 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/destroy_account.rb +2 -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 +10 -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/searches/_filters_small_view.html.erb +1 -1
- 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 +81 -16
- data/config/locales/cs.yml +102 -37
- data/config/locales/de.yml +217 -143
- 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 +78 -13
- data/config/locales/es-PY.yml +77 -12
- data/config/locales/es.yml +80 -15
- data/config/locales/eu.yml +10 -12
- data/config/locales/fi-plain.yml +80 -16
- data/config/locales/fi.yml +89 -25
- 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 +7 -2
- data/config/locales/it.yml +70 -19
- data/config/locales/ja.yml +6 -21
- 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 +100 -25
- 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 +5 -16
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +2 -16
- 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 +637 -246
- data/config/locales/uk.yml +5 -13
- 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/migrate/20210302150803_invalidate_all_sessions_for_deleted_users.rb +11 -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/attribute_encryptor.rb +9 -1
- 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/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 +149 -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 +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 +204 -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
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,6 +17,9 @@ if !Rails.env.production? || ENV["SEED"]
|
|
16
17
|
table.tr("_", "/").classify.safe_constantize
|
17
18
|
end.compact.each(&:reset_column_information)
|
18
19
|
|
20
|
+
smtp_label = ENV["SMTP_FROM_LABEL"] || Faker::Twitter.unique.screen_name
|
21
|
+
smtp_email = ENV["SMTP_FROM_EMAIL"] || Faker::Internet.email
|
22
|
+
|
19
23
|
organization = Decidim::Organization.first || Decidim::Organization.create!(
|
20
24
|
name: Faker::Company.name,
|
21
25
|
twitter_handler: Faker::Hipster.word,
|
@@ -24,15 +28,17 @@ if !Rails.env.production? || ENV["SEED"]
|
|
24
28
|
youtube_handler: Faker::Hipster.word,
|
25
29
|
github_handler: Faker::Hipster.word,
|
26
30
|
smtp_settings: {
|
27
|
-
from:
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
31
|
+
from: "#{smtp_label} <#{smtp_email}>",
|
32
|
+
from_email: smtp_email,
|
33
|
+
from_label: smtp_label,
|
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"
|
32
38
|
},
|
33
39
|
host: ENV["DECIDIM_HOST"] || "localhost",
|
34
40
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
35
|
-
Decidim::Faker::Localized.sentence(15)
|
41
|
+
Decidim::Faker::Localized.sentence(word_count: 15)
|
36
42
|
end,
|
37
43
|
default_locale: Decidim.default_locale,
|
38
44
|
available_locales: Decidim.available_locales,
|
@@ -70,7 +76,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
70
76
|
5.times do
|
71
77
|
Decidim::Scope.create!(
|
72
78
|
name: Decidim::Faker::Localized.literal(Faker::Address.unique.city),
|
73
|
-
code: parent.code
|
79
|
+
code: "#{parent.code}-#{Faker::Address.unique.state_abbr}",
|
74
80
|
scope_type: municipality,
|
75
81
|
organization: organization,
|
76
82
|
parent: parent
|
@@ -120,7 +126,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
120
126
|
admin: true,
|
121
127
|
tos_agreement: true,
|
122
128
|
personal_url: Faker::Internet.url,
|
123
|
-
about: Faker::Lorem.paragraph(2),
|
129
|
+
about: Faker::Lorem.paragraph(sentence_count: 2),
|
124
130
|
accepted_tos_version: organization.tos_version,
|
125
131
|
admin_terms_accepted_at: Time.current
|
126
132
|
)
|
@@ -137,7 +143,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
137
143
|
organization: organization,
|
138
144
|
tos_agreement: true,
|
139
145
|
personal_url: Faker::Internet.url,
|
140
|
-
about: Faker::Lorem.paragraph(2),
|
146
|
+
about: Faker::Lorem.paragraph(sentence_count: 2),
|
141
147
|
accepted_tos_version: organization.tos_version
|
142
148
|
)
|
143
149
|
|
@@ -153,7 +159,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
153
159
|
organization: organization,
|
154
160
|
tos_agreement: true,
|
155
161
|
personal_url: Faker::Internet.url,
|
156
|
-
about: Faker::Lorem.paragraph(2),
|
162
|
+
about: Faker::Lorem.paragraph(sentence_count: 2),
|
157
163
|
accepted_tos_version: organization.tos_version
|
158
164
|
)
|
159
165
|
|
@@ -173,7 +179,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
173
179
|
email: Faker::Internet.email,
|
174
180
|
confirmed_at: Time.current,
|
175
181
|
extended_data: {
|
176
|
-
document_number: Faker::Number.number(10),
|
182
|
+
document_number: Faker::Number.number(digits: 10).to_s,
|
177
183
|
phone: Faker::PhoneNumber.phone_number,
|
178
184
|
verified_at: verified_at
|
179
185
|
},
|
@@ -203,7 +209,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
203
209
|
hero_content_block = Decidim::ContentBlock.find_by(organization: organization, manifest_name: :hero, scope_name: :homepage)
|
204
210
|
hero_content_block.images_container.background_image = File.new(File.join(seeds_root, "homepage_image.jpg"))
|
205
211
|
settings = {}
|
206
|
-
welcome_text = Decidim::Faker::Localized.sentence(5)
|
212
|
+
welcome_text = Decidim::Faker::Localized.sentence(word_count: 5)
|
207
213
|
settings = welcome_text.inject(settings) { |acc, (k, v)| acc.update("welcome_text_#{k}" => v) }
|
208
214
|
hero_content_block.settings = settings
|
209
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
|
@@ -9,10 +9,7 @@ module Decidim
|
|
9
9
|
# name
|
10
10
|
# }
|
11
11
|
#
|
12
|
-
class UserEntityFinder
|
13
|
-
argument :id, types.ID, "The ID of the participant"
|
14
|
-
argument :nickname, types.String, "The @nickname of the participant"
|
15
|
-
|
12
|
+
class UserEntityFinder
|
16
13
|
def call(_obj, args, ctx)
|
17
14
|
filters = {
|
18
15
|
organization: ctx[:current_organization]
|
@@ -9,10 +9,8 @@ module Decidim
|
|
9
9
|
# name
|
10
10
|
# }
|
11
11
|
#
|
12
|
-
class UserEntityList
|
12
|
+
class UserEntityList
|
13
13
|
include NeedsApiFilterAndOrder
|
14
|
-
argument :order, UserEntityInputSort, "Provides several methods to order the results"
|
15
|
-
argument :filter, UserEntityInputFilter, "Provides several methods to filter the results"
|
16
14
|
|
17
15
|
def initialize
|
18
16
|
@model_class = Decidim::UserBaseEntity
|
File without changes
|
@@ -10,41 +10,39 @@ module Decidim
|
|
10
10
|
description "A type used for filtering any component parent objects"
|
11
11
|
|
12
12
|
argument :type,
|
13
|
-
type: String,
|
13
|
+
type: GraphQL::Types::String,
|
14
14
|
description: "Filters by type of component",
|
15
15
|
required: false,
|
16
|
-
prepare:
|
17
|
-
|
18
|
-
|
16
|
+
prepare: lambda { |value, _ctx|
|
17
|
+
{ manifest_name: value.downcase }
|
18
|
+
}
|
19
19
|
argument :name,
|
20
|
-
type: String,
|
20
|
+
type: GraphQL::Types::String,
|
21
21
|
description: "Filters by name of the component, additional locale parameter can be provided to specify in which to search",
|
22
22
|
required: false,
|
23
|
-
prepare:
|
24
|
-
|
23
|
+
prepare: lambda { |search, ctx|
|
24
|
+
lambda { |model_name, locale|
|
25
25
|
locale = ctx[:current_organization].default_locale if locale.blank?
|
26
|
-
op = Arel::Nodes::InfixOperation.new("->>",
|
26
|
+
op = Arel::Nodes::InfixOperation.new("->>", model_name.arel_table[:name], Arel::Nodes.build_quoted(locale))
|
27
27
|
op.matches("%#{search}%")
|
28
|
-
|
29
|
-
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
30
31
|
argument :with_geolocation_enabled,
|
31
|
-
type: Boolean,
|
32
|
+
type: GraphQL::Types::Boolean,
|
32
33
|
description: "Returns components with geolocation activated (may be Proposals or Meetings)",
|
33
34
|
required: false,
|
34
|
-
prepare:
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
35
|
+
prepare: lambda { |active, _ctx|
|
36
|
+
->(_model_name, _locale) { ["(settings->'global'->>'geocoding_enabled')::boolean is ? or manifest_name='meetings'", active] }
|
37
|
+
}
|
38
|
+
|
39
39
|
argument :with_comments_enabled,
|
40
|
-
type: Boolean,
|
40
|
+
type: GraphQL::Types::Boolean,
|
41
41
|
description: "Returns components with comments enabled globally (can still be deactivated in the current step if the component has steps)",
|
42
42
|
required: false,
|
43
|
-
prepare:
|
44
|
-
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
43
|
+
prepare: lambda { |active, _ctx|
|
44
|
+
->(_model_name, _locale) { ["(settings->'global'->>'comments_enabled')::boolean is ?", active] }
|
45
|
+
}
|
48
46
|
end
|
49
47
|
end
|
50
48
|
end
|
data/{app/types/decidim/core → lib/decidim/api/input_filters}/has_hastaggable_input_filter.rb
RENAMED
@@ -5,7 +5,7 @@ module Decidim
|
|
5
5
|
module HasHastaggableInputFilter
|
6
6
|
def self.included(child_class)
|
7
7
|
child_class.argument :hashtag,
|
8
|
-
type: String,
|
8
|
+
type: GraphQL::Types::String,
|
9
9
|
description: "List result having this hashtag",
|
10
10
|
required: false,
|
11
11
|
prepare: ->(hashtag, _ctx) { "##{hashtag.sub(/^#/, "")}" }
|
@@ -5,16 +5,16 @@ module Decidim
|
|
5
5
|
module HasLocalizedInputFilter
|
6
6
|
def self.included(child_class)
|
7
7
|
child_class.argument :locale,
|
8
|
-
type: String,
|
8
|
+
type: GraphQL::Types::String,
|
9
9
|
description: "Specify the locale to use when searching translated fields, otherwise default organization language will be used",
|
10
10
|
required: false,
|
11
|
-
prepare:
|
11
|
+
prepare: lambda { |locale, ctx|
|
12
12
|
unless ctx[:current_organization].available_locales.include?(locale)
|
13
13
|
raise GraphQL::ExecutionError, "#{locale} locale is not used in the organization"
|
14
14
|
end
|
15
15
|
|
16
16
|
locale
|
17
|
-
|
17
|
+
}
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
data/{app/types/decidim/core → lib/decidim/api/input_filters}/has_publishable_input_filter.rb
RENAMED
@@ -5,23 +5,23 @@ module Decidim
|
|
5
5
|
module HasPublishableInputFilter
|
6
6
|
def self.included(child_class)
|
7
7
|
child_class.argument :published_before,
|
8
|
-
type: String,
|
8
|
+
type: GraphQL::Types::String,
|
9
9
|
description: "List result published **before** (and **excluding**) this date. Expected format `YYYY-MM-DD`",
|
10
10
|
required: false,
|
11
|
-
prepare:
|
11
|
+
prepare: lambda { |date, _ctx|
|
12
12
|
proc do |model_class|
|
13
13
|
model_class.arel_table[:published_at].lt(date_to_iso8601(date, :publishedBefore))
|
14
14
|
end
|
15
|
-
|
15
|
+
}
|
16
16
|
child_class.argument :published_since,
|
17
|
-
type: String,
|
17
|
+
type: GraphQL::Types::String,
|
18
18
|
description: "List result published after (and **including**) this date. Expected format `YYYY-MM-DD`",
|
19
19
|
required: false,
|
20
|
-
prepare:
|
20
|
+
prepare: lambda { |date, _ctx|
|
21
21
|
proc do |model_class|
|
22
22
|
model_class.arel_table[:published_at].gteq(date_to_iso8601(date, :publishedBefore))
|
23
23
|
end
|
24
|
-
|
24
|
+
}
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.date_to_iso8601(date, key)
|
@@ -5,41 +5,41 @@ module Decidim
|
|
5
5
|
module HasTimestampInputFilter
|
6
6
|
def self.included(child_class)
|
7
7
|
child_class.argument :created_before,
|
8
|
-
type: String,
|
8
|
+
type: GraphQL::Types::String,
|
9
9
|
description: "List result created **before** (and **excluding**) this date. Expected format `YYYY-MM-DD`",
|
10
10
|
required: false,
|
11
|
-
prepare:
|
11
|
+
prepare: lambda { |date, _ctx|
|
12
12
|
proc do |model_class|
|
13
13
|
model_class.arel_table[:created_at].lt(date_to_iso8601(date, :createdBefore))
|
14
14
|
end
|
15
|
-
|
15
|
+
}
|
16
16
|
child_class.argument :created_since,
|
17
|
-
type: String,
|
17
|
+
type: GraphQL::Types::String,
|
18
18
|
description: "List result created after (and **including**) this date. Expected format `YYYY-MM-DD`",
|
19
19
|
required: false,
|
20
|
-
prepare:
|
20
|
+
prepare: lambda { |date, _ctx|
|
21
21
|
proc do |model_class|
|
22
22
|
model_class.arel_table[:created_at].gteq(date_to_iso8601(date, :createdBefore))
|
23
23
|
end
|
24
|
-
|
24
|
+
}
|
25
25
|
child_class.argument :updated_before,
|
26
|
-
type: String,
|
26
|
+
type: GraphQL::Types::String,
|
27
27
|
description: "List result updated **before** (and **excluding**) this date. Expected format `YYYY-MM-DD`",
|
28
28
|
required: false,
|
29
|
-
prepare:
|
29
|
+
prepare: lambda { |date, _ctx|
|
30
30
|
proc do |model_class|
|
31
31
|
model_class.arel_table[:updated_at].lt(date_to_iso8601(date, :updatedBefore))
|
32
32
|
end
|
33
|
-
|
33
|
+
}
|
34
34
|
child_class.argument :updated_since,
|
35
|
-
type: String,
|
35
|
+
type: GraphQL::Types::String,
|
36
36
|
description: "List result updated after (and **including**) this date. Expected format `YYYY-MM-DD`",
|
37
37
|
required: false,
|
38
|
-
prepare:
|
38
|
+
prepare: lambda { |date, _ctx|
|
39
39
|
proc do |model_class|
|
40
40
|
model_class.arel_table[:updated_at].gteq(date_to_iso8601(date, :updatedBefore))
|
41
41
|
end
|
42
|
-
|
42
|
+
}
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.date_to_iso8601(date, key)
|