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
@@ -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)
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
class UserEntityInputFilter < BaseInputFilter
|
6
|
+
graphql_name "UserEntityFilter"
|
7
|
+
description "A type used for filtering any user or group
|
8
|
+
|
9
|
+
A typical query would look like:
|
10
|
+
|
11
|
+
```
|
12
|
+
{
|
13
|
+
users(filter:{wildcard:\"sandy\", excludeIds:[2,10,11]}) {
|
14
|
+
id
|
15
|
+
...on User {
|
16
|
+
groups {
|
17
|
+
name
|
18
|
+
}
|
19
|
+
}
|
20
|
+
...on UserGroup {
|
21
|
+
members {
|
22
|
+
name
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
```
|
28
|
+
"
|
29
|
+
|
30
|
+
argument :type,
|
31
|
+
type: String,
|
32
|
+
description: "Filters by type of entity (User or UserGroup)",
|
33
|
+
required: false,
|
34
|
+
prepare: lambda { |value, _ctx|
|
35
|
+
type = value.downcase.camelcase
|
36
|
+
type = "UserGroup" if %w(Group Usergroup).include?(type)
|
37
|
+
{ type: "Decidim::#{type}" }
|
38
|
+
}
|
39
|
+
argument :name,
|
40
|
+
type: String,
|
41
|
+
description: "Filters by name of the user entity. Searches (case insensitive) any fragment of the provided string",
|
42
|
+
required: false,
|
43
|
+
prepare: lambda { |value, _ctx|
|
44
|
+
[
|
45
|
+
lambda { |model_class, _locale|
|
46
|
+
model_class.arel_table[:name].matches("%#{value}%")
|
47
|
+
}
|
48
|
+
]
|
49
|
+
}
|
50
|
+
argument :nickname,
|
51
|
+
type: String,
|
52
|
+
description: "Filters by nickname of the user entity. Searches (case insensitive) any fragment of the provided string",
|
53
|
+
required: false,
|
54
|
+
prepare: lambda { |value, _ctx|
|
55
|
+
value = value[1..-1] if value.starts_with? "@"
|
56
|
+
[
|
57
|
+
lambda { |model_class, _locale|
|
58
|
+
model_class.arel_table[:nickname].matches("%#{value}%")
|
59
|
+
}
|
60
|
+
]
|
61
|
+
}
|
62
|
+
argument :wildcard,
|
63
|
+
type: String,
|
64
|
+
description: "Filters by nickname or name of the user entity. Searches (case insensitive) any fragment of the provided string",
|
65
|
+
required: false,
|
66
|
+
prepare: lambda { |value, _ctx|
|
67
|
+
value = value[1..-1] if value.starts_with? "@"
|
68
|
+
[
|
69
|
+
lambda { |model_class, _locale|
|
70
|
+
op_name = model_class.arel_table[:name].matches("%#{value}%")
|
71
|
+
op_nick = model_class.arel_table[:nickname].matches("%#{value}%")
|
72
|
+
op_name.or(op_nick)
|
73
|
+
}
|
74
|
+
]
|
75
|
+
}
|
76
|
+
argument :exclude_ids,
|
77
|
+
type: [ID],
|
78
|
+
description: "Excludes users contained in given ids. Valid values are one or more IDs (passed as an array)",
|
79
|
+
required: false,
|
80
|
+
prepare: lambda { |value, _ctx|
|
81
|
+
[
|
82
|
+
lambda { |model_class, _locale|
|
83
|
+
model_class.arel_table[:id].not_in(value)
|
84
|
+
}
|
85
|
+
]
|
86
|
+
}
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -6,8 +6,9 @@ module Decidim
|
|
6
6
|
# Overwrite the prepare method to allow 2 possible values only
|
7
7
|
def prepare
|
8
8
|
arguments.each do |key, value|
|
9
|
-
next if key == "locale"
|
10
|
-
|
9
|
+
next if key.to_s == "locale"
|
10
|
+
next if value.respond_to?(:call)
|
11
|
+
raise GraphQL::ExecutionError, "Invalid order value for #{key.inspect}, only ASC or DESC are valids (received #{value.inspect})" unless valid_order?(value)
|
11
12
|
end
|
12
13
|
super
|
13
14
|
end
|
@@ -8,25 +8,24 @@ module Decidim
|
|
8
8
|
graphql_name "ComponentSort"
|
9
9
|
description "A type used for sorting any component parent objects"
|
10
10
|
|
11
|
-
argument :id, String, "Sort by ID, valid values are ASC or DESC", required: false
|
12
|
-
argument :weight, String, "Sort by weight (order in the website), valid values are ASC or DESC", required: false
|
11
|
+
argument :id, GraphQL::Types::String, "Sort by ID, valid values are ASC or DESC", required: false
|
12
|
+
argument :weight, GraphQL::Types::String, "Sort by weight (order in the website), valid values are ASC or DESC", required: false
|
13
13
|
argument :type,
|
14
|
-
type: String,
|
14
|
+
type: GraphQL::Types::String,
|
15
15
|
description: "Sort by type of component, alphabetically, valid values are ASC or DESC",
|
16
16
|
required: false,
|
17
|
-
|
18
|
-
{ manifest_name: direction }
|
19
|
-
end
|
17
|
+
as: :manifest_name
|
20
18
|
argument :name,
|
21
|
-
type: String,
|
19
|
+
type: GraphQL::Types::String,
|
22
20
|
description: "Sort by name of the component, alphabetically, valid values are ASC or DESC",
|
23
21
|
required: false,
|
24
|
-
|
25
|
-
|
22
|
+
as: :name,
|
23
|
+
prepare: lambda { |direction, ctx|
|
24
|
+
lambda { |locale|
|
26
25
|
locale = ctx[:current_organization].default_locale if locale.blank?
|
27
26
|
[Arel.sql("name->? #{direction.upcase}"), locale]
|
28
|
-
|
29
|
-
|
27
|
+
}
|
28
|
+
}
|
30
29
|
end
|
31
30
|
end
|
32
31
|
end
|
@@ -5,12 +5,10 @@ module Decidim
|
|
5
5
|
module HasEndorsableInputSort
|
6
6
|
def self.included(child_class)
|
7
7
|
child_class.argument :endorsement_count,
|
8
|
-
type: String,
|
8
|
+
type: GraphQL::Types::String,
|
9
9
|
description: "Sort by number of endorsements, valid values are ASC or DESC",
|
10
10
|
required: false,
|
11
|
-
|
12
|
-
{ endorsements_count: value }
|
13
|
-
end
|
11
|
+
as: :endorsements_count
|
14
12
|
end
|
15
13
|
end
|
16
14
|
end
|
@@ -5,16 +5,16 @@ module Decidim
|
|
5
5
|
module HasLocalizedInputSort
|
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 ordering 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
|
@@ -4,7 +4,7 @@ module Decidim
|
|
4
4
|
module Core
|
5
5
|
module HasPublishableInputSort
|
6
6
|
def self.included(child_class)
|
7
|
-
child_class.argument :published_at, String, "Sort by date of publication, valid values are ASC or DESC", required: false
|
7
|
+
child_class.argument :published_at, GraphQL::Types::String, "Sort by date of publication, valid values are ASC or DESC", required: false
|
8
8
|
# child_class.argument :created_at, String, "Sort by date of creation, valid values are ASC or DESC", required: false
|
9
9
|
# child_class.argument :updated_at, String, "Sort by date of last modification, valid values are ASC or DESC", required: false
|
10
10
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
module HasTimestampInputSort
|
6
|
+
def self.included(child_class)
|
7
|
+
child_class.argument :created_at, GraphQL::Types::String, "Sort by date of creation, valid values are ASC or DESC", required: false
|
8
|
+
child_class.argument :updated_at, GraphQL::Types::String, "Sort by date of last modification, valid values are ASC or DESC", required: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/{app/types/decidim/core → lib/decidim/api/input_sorts}/participatory_space_input_sort.rb
RENAMED
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
graphql_name "ParticipatorySpaceSort"
|
9
9
|
description "A type used for sorting any generic participatory space"
|
10
10
|
|
11
|
-
argument :id, String, "Sort by ID, valid values are ASC or DESC", required: false
|
11
|
+
argument :id, GraphQL::Types::String, "Sort by ID, valid values are ASC or DESC", required: false
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -6,17 +6,17 @@ module Decidim
|
|
6
6
|
graphql_name "UserEntitySort"
|
7
7
|
description "A type used for sorting any component parent objects"
|
8
8
|
|
9
|
-
argument :id, String, "Sort by ID, valid values are ASC or DESC", required: false
|
9
|
+
argument :id, GraphQL::Types::String, "Sort by ID, valid values are ASC or DESC", required: false
|
10
10
|
argument :type,
|
11
|
-
type: String,
|
11
|
+
type: GraphQL::Types::String,
|
12
12
|
description: "Sort by type of user entity (user or group), alphabetically, valid values are ASC or DESC",
|
13
13
|
required: false
|
14
14
|
argument :name,
|
15
|
-
type: String,
|
15
|
+
type: GraphQL::Types::String,
|
16
16
|
description: "Sort by name of the user entity (user or group), alphabetically, valid values are ASC or DESC",
|
17
17
|
required: false
|
18
18
|
argument :nickname,
|
19
|
-
type: String,
|
19
|
+
type: GraphQL::Types::String,
|
20
20
|
description: "Sort by nickname of the user entity (user or group), alphabetically, valid values are ASC or DESC",
|
21
21
|
required: false
|
22
22
|
end
|
data/lib/decidim/api/{amendable_entity_interface.rb → interfaces/amendable_entity_interface.rb}
RENAMED
@@ -4,15 +4,15 @@ module Decidim
|
|
4
4
|
module Core
|
5
5
|
# This interface should be implemented by any Type that can be used as amendment
|
6
6
|
# The only requirement is to have an ID and the Type name be the class.name + Type
|
7
|
-
AmendableEntityInterface
|
8
|
-
|
7
|
+
module AmendableEntityInterface
|
8
|
+
include Decidim::Api::Types::BaseInterface
|
9
9
|
description "An interface that can be used in objects with amendments"
|
10
10
|
|
11
|
-
field :id,
|
11
|
+
field :id, ID, "ID of this entity", null: false
|
12
12
|
|
13
|
-
resolve_type
|
13
|
+
def self.resolve_type(obj, _ctx)
|
14
14
|
"#{obj.class.name}Type".constantize
|
15
|
-
|
15
|
+
end
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
# This interface represents an amendable object.
|
6
|
+
module AmendableInterface
|
7
|
+
include Decidim::Api::Types::BaseInterface
|
8
|
+
description "An interface that can be used in objects with amendments"
|
9
|
+
|
10
|
+
field :amendments, [Decidim::Core::AmendmentType, { null: true }], description: "This object's amendments", null: false
|
11
|
+
|
12
|
+
def amendments
|
13
|
+
object.visible_amendments_for(context[:current_user])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -3,11 +3,11 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Core
|
5
5
|
# This interface represents a attachable object.
|
6
|
-
AttachableInterface
|
7
|
-
|
6
|
+
module AttachableInterface
|
7
|
+
include Decidim::Api::Types::BaseInterface
|
8
8
|
description "An interface that can be used in objects with attachments"
|
9
9
|
|
10
|
-
field :attachments,
|
10
|
+
field :attachments, [Decidim::Core::AttachmentType, { null: true }], "This object's attachments", null: false
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
# This interface represents an author who owns a resource.
|
6
|
+
module AuthorInterface
|
7
|
+
include Decidim::Api::Types::BaseInterface
|
8
|
+
graphql_name "Author"
|
9
|
+
description "An author"
|
10
|
+
|
11
|
+
field :id, ID, "The author ID", null: false
|
12
|
+
field :name, String, "The author's name", null: false
|
13
|
+
field :nickname, String, "The author's nickname", null: false
|
14
|
+
|
15
|
+
field :avatar_url, String, "The author's avatar url", null: false
|
16
|
+
field :profile_path, String, "The author's profile path", null: false
|
17
|
+
field :badge, String, "The author's badge icon", null: false
|
18
|
+
field :organization_name, String, "The authors's organization name", null: false
|
19
|
+
|
20
|
+
def organization_name
|
21
|
+
object.organization.name
|
22
|
+
end
|
23
|
+
|
24
|
+
field :deleted, Boolean, "Whether the author's account has been deleted or not", null: false
|
25
|
+
|
26
|
+
def self.resolve_type(obj, _ctx)
|
27
|
+
return Decidim::Core::UserType if obj.is_a? Decidim::User
|
28
|
+
return Decidim::Core::UserGroupType if obj.is_a? Decidim::UserGroup
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
# This interface represents a commentable object.
|
6
|
+
module AuthorableInterface
|
7
|
+
include Decidim::Api::Types::BaseInterface
|
8
|
+
description "An interface that can be used in authorable objects."
|
9
|
+
|
10
|
+
field :author, Decidim::Core::AuthorInterface, "The resource author", null: true do
|
11
|
+
# can be an Authorable or a Coauthorable
|
12
|
+
end
|
13
|
+
|
14
|
+
def author
|
15
|
+
if object.respond_to?(:normalized_author)
|
16
|
+
object&.normalized_author
|
17
|
+
elsif object.respond_to?(:creator_identity)
|
18
|
+
object&.creator_identity
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -3,11 +3,11 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Core
|
5
5
|
# This interface represents a categorizable object.
|
6
|
-
CategorizableInterface
|
7
|
-
|
6
|
+
module CategorizableInterface
|
7
|
+
include Decidim::Api::Types::BaseInterface
|
8
8
|
description "An interface that can be used in categorizable objects."
|
9
9
|
|
10
|
-
field :category, Decidim::Core::CategoryType, "The object's category"
|
10
|
+
field :category, Decidim::Core::CategoryType, "The object's category", null: false
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
# This interface represents a coauthorable object.
|
6
|
+
module CoauthorableInterface
|
7
|
+
include Decidim::Api::Types::BaseInterface
|
8
|
+
description "An interface that can be used in coauthorable objects."
|
9
|
+
|
10
|
+
field :authors_count, Integer,
|
11
|
+
method: :coauthorships_count,
|
12
|
+
description: "The total amount of co-authors that contributed to the entity. Note that this field may include also non-user authors like meetings or the organization",
|
13
|
+
null: true
|
14
|
+
|
15
|
+
field :author, Decidim::Core::AuthorInterface,
|
16
|
+
description: "The resource author. Note that this can be null on official proposals or meeting-proposals",
|
17
|
+
null: true
|
18
|
+
|
19
|
+
def author
|
20
|
+
author = object.creator_identity
|
21
|
+
author if author.is_a?(Decidim::User) || author.is_a?(Decidim::UserGroup)
|
22
|
+
end
|
23
|
+
|
24
|
+
field :authors, [Decidim::Core::AuthorInterface, { null: true }],
|
25
|
+
method: :user_identities,
|
26
|
+
description: "The resource co-authors. Include only users or groups of users",
|
27
|
+
null: false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
module ComponentInterface
|
6
|
+
include Decidim::Api::Types::BaseInterface
|
7
|
+
description "This interface is implemented by all components that belong into a Participatory Space"
|
8
|
+
|
9
|
+
field :id, ID, "The Component's unique ID", null: false
|
10
|
+
|
11
|
+
field :name, TranslatedFieldType, "The name of this component.", null: false
|
12
|
+
|
13
|
+
field :weight, Integer, "The weight of the component", null: false
|
14
|
+
|
15
|
+
field :participatory_space, ParticipatorySpaceType, "The participatory space in which this component belongs to.", null: false
|
16
|
+
|
17
|
+
def self.resolve_type(obj, _ctx)
|
18
|
+
obj.manifest.query_type.constantize
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|