decidim-core 0.15.2 → 0.16.0
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 +14 -1
- data/app/assets/config/decidim_core_manifest.js +14 -12
- data/app/assets/images/decidim/pattern.png +0 -0
- data/app/assets/javascripts/decidim.js.es6 +4 -0
- data/app/assets/javascripts/decidim/floating_help.js.es6 +40 -0
- data/app/assets/javascripts/decidim/input_hashtags.js.es6 +6 -4
- data/app/assets/javascripts/decidim/notifications.js.es6 +1 -1
- data/app/assets/javascripts/decidim/tooltip_keep_on_hover.js.es6 +18 -0
- data/app/assets/javascripts/decidim/vizzs/areachart.js.es6 +52 -10
- data/app/assets/javascripts/decidim/vizzs/metrics.js.es6 +68 -22
- data/app/assets/javascripts/decidim/vizzs/orgchart.js.es6 +10 -13
- data/app/assets/stylesheets/decidim/conference-diploma.css.scss +61 -0
- data/app/assets/stylesheets/decidim/layouts/_home.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_buttons.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_cards.scss +17 -1
- data/app/assets/stylesheets/decidim/modules/_conference-programme.scss +0 -4
- data/app/assets/stylesheets/decidim/modules/_filters.scss +37 -2
- data/app/assets/stylesheets/decidim/modules/_floating-helper.scss +106 -0
- data/app/assets/stylesheets/decidim/modules/_forms.scss +22 -0
- data/app/assets/stylesheets/decidim/modules/_help.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_layout.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_margins.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_modules.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +5 -1
- data/app/assets/stylesheets/decidim/modules/_order-by.scss +11 -1
- data/app/assets/stylesheets/decidim/modules/_process-header.scss +36 -38
- data/app/assets/stylesheets/decidim/modules/_process-nav.scss +61 -10
- data/app/assets/stylesheets/decidim/modules/_process-phase.scss +63 -30
- data/app/assets/stylesheets/decidim/modules/_share.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_typography.scss +17 -0
- data/app/assets/stylesheets/decidim/{modules → vizzs}/_orgchart.scss +2 -10
- data/app/cells/decidim/activities_cell.rb +6 -2
- data/app/cells/decidim/activity/show.erb +22 -19
- data/app/cells/decidim/activity_cell.rb +35 -5
- data/app/cells/decidim/amendable/amend_button_card/show.erb +9 -0
- data/app/cells/decidim/amendable/amend_button_card_cell.rb +43 -0
- data/app/cells/decidim/amendable/amenders_list/show.erb +18 -0
- data/app/cells/decidim/amendable/amenders_list_cell.rb +7 -0
- data/app/cells/decidim/amendable/announcement_cell.rb +58 -0
- data/app/cells/decidim/amendable/emendation_actions/show.erb +13 -0
- data/app/cells/decidim/amendable/emendation_actions_cell.rb +52 -0
- data/app/cells/decidim/amendable/promote_button_card/show.erb +9 -0
- data/app/cells/decidim/amendable/promote_button_card_cell.rb +47 -0
- data/app/cells/decidim/author/profile_inline.erb +23 -4
- data/app/cells/decidim/author/profile_minicard.erb +25 -0
- data/app/cells/decidim/author/show.erb +0 -1
- data/app/cells/decidim/author_cell.rb +6 -0
- data/app/cells/decidim/card_cell.rb +2 -4
- data/app/cells/decidim/card_m/top.erb +1 -1
- data/app/cells/decidim/card_m_cell.rb +3 -0
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +1 -1
- data/app/cells/decidim/follow_button/show.erb +0 -1
- data/app/cells/decidim/follow_button_cell.rb +10 -0
- data/app/cells/decidim/following/show.erb +1 -1
- data/app/cells/decidim/following_cell.rb +1 -1
- data/app/cells/decidim/notifications/show.erb +1 -0
- data/app/cells/decidim/pad_iframe/show.erb +14 -0
- data/app/cells/decidim/pad_iframe_cell.rb +57 -0
- data/app/cells/decidim/profile/user_tabs.erb +8 -6
- data/app/cells/decidim/profile_cell.rb +1 -1
- data/app/cells/decidim/profile_sidebar/show.erb +58 -42
- data/app/cells/decidim/profile_sidebar_cell.rb +6 -0
- data/app/cells/decidim/search_results/show.erb +8 -0
- data/app/cells/decidim/search_results_cell.rb +38 -0
- data/app/cells/decidim/search_results_section/show.erb +24 -0
- data/app/cells/decidim/search_results_section_cell.rb +35 -0
- data/app/cells/decidim/user_activity/show.erb +15 -0
- data/app/cells/decidim/user_activity_cell.rb +17 -0
- data/app/cells/decidim/user_profile/header.erb +1 -16
- data/app/cells/decidim/user_profile/user_data.erb +16 -0
- data/app/cells/decidim/user_profile_cell.rb +4 -0
- data/app/cells/decidim/user_timeline/show.erb +15 -0
- data/app/cells/decidim/user_timeline_cell.rb +17 -0
- data/app/commands/decidim/accept_user_group_join_request.rb +1 -1
- data/app/commands/decidim/amendable/accept.rb +84 -0
- data/app/commands/decidim/amendable/create.rb +103 -0
- data/app/commands/decidim/amendable/promote.rb +79 -0
- data/app/commands/decidim/amendable/reject.rb +60 -0
- data/app/commands/decidim/amendable/withdraw.rb +46 -0
- data/app/commands/decidim/create_omniauth_registration.rb +17 -1
- data/app/commands/decidim/create_registration.rb +2 -0
- data/app/commands/decidim/demote_membership.rb +1 -1
- data/app/commands/decidim/invite_user.rb +1 -1
- data/app/commands/decidim/invite_user_to_group.rb +1 -1
- data/app/commands/decidim/join_user_group.rb +1 -7
- data/app/commands/decidim/messaging/reply_to_conversation.rb +1 -1
- data/app/commands/decidim/promote_membership.rb +1 -1
- data/app/commands/decidim/reject_user_group_join_request.rb +1 -1
- data/app/commands/decidim/remove_user_from_group.rb +1 -1
- data/app/commands/decidim/search.rb +65 -16
- data/app/commands/decidim/update_account.rb +1 -1
- data/app/commands/decidim/update_notifications_settings.rb +2 -1
- data/app/commands/decidim/update_user_interests.rb +35 -0
- data/app/controllers/concerns/decidim/amendments_controller.rb +104 -0
- data/app/controllers/concerns/decidim/participatory_space_context.rb +28 -6
- data/app/controllers/concerns/decidim/user_groups.rb +23 -0
- data/app/controllers/concerns/decidim/user_profile.rb +2 -4
- data/app/controllers/decidim/components/base_controller.rb +1 -0
- data/app/controllers/decidim/devise/confirmations_controller.rb +9 -0
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +2 -1
- data/app/controllers/decidim/devise/passwords_controller.rb +6 -0
- data/app/controllers/decidim/devise/registrations_controller.rb +5 -0
- data/app/controllers/decidim/devise/sessions_controller.rb +12 -0
- data/app/controllers/decidim/group_admins_controller.rb +3 -0
- data/app/controllers/decidim/group_email_confirmations_controller.rb +32 -0
- data/app/controllers/decidim/group_invites_controller.rb +3 -0
- data/app/controllers/decidim/group_members_controller.rb +3 -0
- data/app/controllers/decidim/groups_controller.rb +3 -0
- data/app/controllers/decidim/homepage_controller.rb +10 -0
- data/app/controllers/decidim/last_activities_controller.rb +1 -1
- data/app/controllers/decidim/messaging/conversations_controller.rb +11 -2
- data/app/controllers/decidim/open_data_controller.rb +31 -0
- data/app/controllers/decidim/own_user_groups_controller.rb +3 -1
- data/app/controllers/decidim/pages_controller.rb +7 -15
- data/app/controllers/decidim/profiles_controller.rb +13 -2
- data/app/controllers/decidim/searches_controller.rb +11 -2
- data/app/controllers/decidim/user_activities_controller.rb +28 -0
- data/app/controllers/decidim/user_group_join_requests_controller.rb +3 -0
- data/app/controllers/decidim/user_interests_controller.rb +32 -0
- data/app/controllers/decidim/user_timeline_controller.rb +40 -0
- data/app/events/decidim/amendable/amendment_accepted_event.rb +23 -0
- data/app/events/decidim/amendable/amendment_base_event.rb +39 -0
- data/app/events/decidim/amendable/amendment_created_event.rb +23 -0
- data/app/events/decidim/amendable/amendment_rejected_event.rb +23 -0
- data/app/events/decidim/amendable/emendation_promoted_event.rb +23 -0
- data/app/events/decidim/welcome_notification_event.rb +58 -0
- data/app/forms/decidim/amendable/create_form.rb +54 -0
- data/app/forms/decidim/amendable/form.rb +22 -0
- data/app/forms/decidim/amendable/promote_form.rb +26 -0
- data/app/forms/decidim/amendable/reject_form.rb +14 -0
- data/app/forms/decidim/amendable/review_form.rb +35 -0
- data/app/forms/decidim/notifications_settings_form.rb +19 -6
- data/app/forms/decidim/omniauth_registration_form.rb +2 -1
- data/app/forms/decidim/user_group_form.rb +1 -2
- data/app/forms/decidim/user_interest_scope_form.rb +25 -0
- data/app/forms/decidim/user_interests_form.rb +22 -0
- data/app/helpers/decidim/amendments_helper.rb +130 -0
- data/app/helpers/decidim/application_helper.rb +19 -2
- data/app/helpers/decidim/card_helper.rb +0 -2
- data/app/helpers/decidim/cells_paginate_helper.rb +4 -0
- data/app/helpers/decidim/contextual_help_helper.rb +10 -0
- data/app/helpers/decidim/cta_button_helper.rb +3 -1
- data/app/helpers/decidim/decidim_form_helper.rb +1 -1
- data/app/helpers/decidim/layout_helper.rb +13 -0
- data/app/helpers/decidim/multi_translation_helper.rb +0 -0
- data/app/helpers/decidim/omniauth_helper.rb +9 -1
- data/app/helpers/decidim/pad_helper.rb +16 -0
- data/app/helpers/decidim/participatory_space_helpers.rb +15 -0
- data/app/helpers/decidim/searches_helper.rb +50 -6
- data/app/helpers/decidim/translations_helper.rb +3 -2
- data/app/jobs/decidim/email_notification_generator_job.rb +4 -2
- data/app/jobs/decidim/metric_job.rb +1 -1
- data/app/jobs/decidim/notification_generator_for_recipient_job.rb +2 -2
- data/app/jobs/decidim/notification_generator_job.rb +4 -2
- data/app/jobs/decidim/open_data_job.rb +16 -0
- data/app/mailers/decidim/messaging/conversation_mailer.rb +5 -2
- data/app/mailers/decidim/newsletter_mailer.rb +6 -2
- data/app/mailers/decidim/notification_mailer.rb +2 -2
- data/app/models/decidim/action_log.rb +7 -0
- data/app/models/decidim/amendment.rb +17 -0
- data/app/models/decidim/component.rb +8 -0
- data/app/models/decidim/contextual_help_section.rb +41 -0
- data/app/models/decidim/follow.rb +30 -0
- data/app/models/decidim/notification.rb +11 -1
- data/app/models/decidim/organization.rb +41 -0
- data/app/models/decidim/searchable_resource.rb +3 -0
- data/app/models/decidim/static_page.rb +11 -0
- data/app/models/decidim/static_page_topic.rb +12 -0
- data/app/models/decidim/user.rb +25 -2
- data/app/models/decidim/user_base_entity.rb +0 -6
- data/app/models/decidim/user_group.rb +29 -3
- data/app/permissions/decidim/permissions.rb +12 -0
- data/app/presenters/decidim/admin_log/organization_presenter.rb +13 -0
- data/app/presenters/decidim/admin_log/user_group_presenter.rb +1 -1
- data/app/presenters/decidim/admin_log/user_presenter.rb +1 -1
- data/app/presenters/decidim/hashtag_presenter.rb +7 -2
- data/app/presenters/decidim/metric_charts_presenter.rb +54 -21
- data/app/presenters/decidim/user_presenter.rb +4 -8
- data/app/queries/decidim/messaging/user_conversations.rb +1 -1
- data/app/queries/decidim/metric_manage.rb +16 -2
- data/app/queries/decidim/metric_measure.rb +35 -0
- data/app/queries/decidim/metrics/followers_metric_manage.rb +64 -0
- data/app/queries/decidim/metrics/participants_metric_manage.rb +72 -0
- data/app/queries/decidim/metrics/users_metric_manage.rb +1 -1
- data/app/queries/decidim/public_components.rb +32 -0
- data/app/resolvers/decidim/core/metric_resolver.rb +43 -11
- data/app/services/decidim/action_logger.rb +10 -0
- data/app/services/decidim/activity_search.rb +88 -13
- data/app/services/decidim/email_notification_generator.rb +23 -8
- data/app/services/decidim/events_manager.rb +9 -3
- data/app/services/decidim/home_activity_search.rb +80 -0
- data/app/services/decidim/log/diff_changeset_calculator.rb +3 -1
- data/app/services/decidim/notification_generator.rb +19 -7
- data/app/services/decidim/notification_generator_for_recipient.rb +6 -9
- data/app/services/decidim/open_data_exporter.rb +55 -0
- data/app/uploaders/decidim/open_data_uploader.rb +17 -0
- data/app/views/decidim/amendments/_form.html.erb +30 -0
- data/app/views/decidim/amendments/_review_form.html.erb +19 -0
- data/app/views/decidim/amendments/new.html.erb +29 -0
- data/app/views/decidim/amendments/review.html.erb +33 -0
- data/app/views/decidim/devise/registrations/new.html.erb +2 -2
- data/app/views/decidim/devise/sessions/new.html.erb +42 -29
- data/app/views/decidim/devise/shared/_links.html.erb +3 -3
- data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +7 -5
- data/app/views/decidim/follows/update_button.js.erb +1 -1
- data/app/views/decidim/group_members/index.html.erb +1 -1
- data/app/views/decidim/groups/_form.html.erb +9 -8
- data/app/views/decidim/groups/new.html.erb +3 -0
- data/app/views/decidim/{pages/home.html.erb → homepage/show.html.erb} +0 -0
- data/app/views/decidim/messaging/conversation_mailer/new_conversation.html.erb +6 -0
- data/app/views/decidim/messaging/conversation_mailer/new_message.html.erb +6 -0
- data/app/views/decidim/messaging/conversations/_message.html.erb +14 -0
- data/app/views/decidim/messaging/conversations/_reply.html.erb +11 -0
- data/app/views/decidim/messaging/conversations/_show.html.erb +21 -0
- data/app/views/decidim/messaging/conversations/_start.html.erb +12 -0
- data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
- data/app/views/decidim/messaging/conversations/index.html.erb +51 -1
- data/app/views/decidim/messaging/conversations/new.html.erb +5 -1
- data/app/views/decidim/messaging/conversations/show.html.erb +9 -1
- data/app/views/decidim/messaging/conversations/update.js.erb +1 -1
- data/app/views/decidim/notification_mailer/event_received.html.erb +13 -3
- data/app/views/decidim/notifications/index.html.erb +5 -1
- data/app/views/decidim/notifications_settings/show.html.erb +19 -0
- data/app/views/decidim/pages/_standalone.html.erb +21 -0
- data/app/views/decidim/pages/_tabbed.html.erb +45 -0
- data/app/views/decidim/pages/index.html.erb +68 -29
- data/app/views/decidim/pages/show.html.erb +28 -0
- data/app/views/decidim/profiles/show.html.erb +1 -1
- data/app/views/decidim/searches/_count.html.erb +26 -1
- data/app/views/decidim/searches/_filters.html.erb +40 -17
- data/app/views/decidim/searches/index.html.erb +5 -16
- data/app/views/decidim/searches/index.js.erb +5 -3
- data/app/views/decidim/shared/_extended_navigation_bar.html.erb +50 -0
- data/app/views/decidim/shared/_floating_help.html.erb +30 -0
- data/app/views/decidim/shared/_follow_button.html.erb +1 -1
- data/app/views/decidim/shared/_login_modal.html.erb +35 -22
- data/app/views/decidim/shared/_results_per_page.html.erb +1 -1
- data/app/views/decidim/shared/_share_modal.html.erb +1 -1
- data/app/views/decidim/user_activities/index.html.erb +5 -0
- data/app/views/decidim/user_interests/_areas.html.erb +14 -0
- data/app/views/decidim/user_interests/_scopes.html.erb +15 -0
- data/app/views/decidim/user_interests/show.html.erb +12 -0
- data/app/views/decidim/user_timeline/index.html.erb +4 -0
- data/app/views/layouts/decidim/_user_menu.html.erb +1 -1
- data/app/views/layouts/decidim/_wrapper.html.erb +12 -5
- data/config/locales/ca.yml +199 -13
- data/config/locales/de.yml +200 -13
- data/config/locales/en.yml +200 -13
- data/config/locales/es-PY.yml +200 -13
- data/config/locales/es.yml +200 -13
- data/config/locales/eu.yml +200 -13
- data/config/locales/fi-pl.yml +200 -13
- data/config/locales/fi.yml +200 -13
- data/config/locales/fr.yml +200 -13
- data/config/locales/gl.yml +200 -13
- data/config/locales/hu.yml +200 -13
- data/config/locales/id-ID.yml +198 -13
- data/config/locales/it.yml +200 -13
- data/config/locales/nl.yml +200 -13
- data/config/locales/pl.yml +204 -13
- data/config/locales/pt-BR.yml +200 -13
- data/config/locales/pt.yml +200 -13
- data/config/locales/ru.yml +2 -16
- data/config/locales/sv.yml +200 -13
- data/config/locales/tr-TR.yml +200 -13
- data/config/locales/uk.yml +2 -16
- data/config/routes.rb +27 -1
- data/db/migrate/20171212103803_create_unique_nicknames.rb +1 -1
- data/db/migrate/20180221101934_fix_nickname_index.rb +1 -1
- data/db/migrate/20180706104107_add_nickname_to_managed_users.rb +1 -1
- data/db/migrate/20180720114847_create_decidim_amendments.rb +21 -0
- data/db/migrate/20181001124950_move_users_groups_to_users_table.rb +1 -1
- data/db/migrate/20181022090732_add_columns_to_pages.rb +20 -0
- data/db/migrate/20181023104416_add_static_page_topics.rb +15 -0
- data/db/migrate/20181025082245_add_timestamps_to_components.rb +12 -0
- data/db/migrate/20181029121244_add_welcome_notification.rb +13 -0
- data/db/migrate/20181108131058_add_users_registration_mode_to_organizations.rb +7 -0
- data/db/migrate/20181113101935_create_decidim_contextual_help_sections.rb +11 -0
- data/db/migrate/20181115102958_add_following_and_followers_counters_to_users.rb +26 -0
- data/db/migrate/20181119140636_add_columns_to_static_page_topic.rb +10 -0
- data/db/migrate/20181126145142_add_id_documents_fields_to_org.rb +13 -0
- data/db/migrate/20181204110723_remove_following_users_count_from_users.rb +17 -0
- data/db/migrate/20181211080834_add_scope_to_action_logs.rb +7 -0
- data/db/migrate/20181211090933_add_area_to_action_logs.rb +7 -0
- data/db/migrate/20181214101250_add_notification_types_to_users.rb +12 -0
- data/db/migrate/20181218171503_add_user_groups_switch_to_organizations.rb +8 -0
- data/db/seeds.rb +6 -1
- data/lib/decidim/amendable.rb +86 -0
- data/lib/decidim/api/component_interface.rb +4 -0
- data/lib/decidim/api/participatory_space_interface.rb +7 -0
- data/lib/decidim/api/scopable_interface.rb +1 -1
- data/lib/decidim/coauthorable.rb +16 -7
- data/lib/decidim/component_manifest.rb +3 -2
- data/lib/decidim/components/export_manifest.rb +13 -2
- data/lib/decidim/content_parsers/hashtag_parser.rb +48 -15
- data/lib/decidim/content_parsers/user_parser.rb +26 -10
- data/lib/decidim/content_renderers/hashtag_renderer.rb +46 -23
- data/lib/decidim/core.rb +40 -2
- data/lib/decidim/core/engine.rb +46 -12
- data/lib/decidim/core/test.rb +11 -0
- data/lib/decidim/core/test/factories.rb +44 -15
- data/lib/decidim/core/test/shared_examples/amendable/accept_amendment_examples.rb +57 -0
- data/lib/decidim/core/test/shared_examples/amendable/amendment_accepted_event_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb +48 -0
- data/lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb +45 -0
- data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/amendable/create_amendment_examples.rb +78 -0
- data/lib/decidim/core/test/shared_examples/amendable/promote_amendment_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb +41 -0
- data/lib/decidim/core/test/shared_examples/amendable/withdraw_amendment_examples.rb +29 -0
- data/lib/decidim/core/test/shared_examples/has_contextual_help.rb +30 -0
- data/lib/decidim/core/test/shared_examples/resourceable.rb +17 -0
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/simple_event.rb +24 -2
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/events/base_event.rb +17 -12
- data/lib/decidim/events/simple_event.rb +21 -2
- data/lib/decidim/form_builder.rb +8 -0
- data/lib/decidim/gamification/badge_scorer.rb +3 -3
- data/lib/decidim/has_component.rb +1 -1
- data/lib/decidim/hashtag.rb +0 -2
- data/lib/decidim/hashtaggable.rb +2 -2
- data/lib/decidim/metric_manifest.rb +17 -2
- data/lib/decidim/metric_operation.rb +59 -0
- data/lib/decidim/metric_operation_manifest.rb +20 -0
- data/lib/decidim/metric_registry.rb +57 -19
- data/lib/decidim/paddable.rb +82 -0
- data/lib/decidim/participable.rb +24 -0
- data/lib/decidim/participatory_space_resourceable.rb +12 -0
- data/lib/decidim/query_extensions.rb +8 -1
- data/lib/decidim/resource_manifest.rb +5 -1
- data/lib/decidim/resourceable.rb +12 -0
- data/lib/decidim/searchable.rb +13 -4
- data/lib/decidim/settings_manifest.rb +2 -1
- data/lib/tasks/decidim_data_portability_tasks.rake +86 -0
- data/lib/tasks/decidim_open_data_tasks.rake +12 -0
- data/lib/tasks/decidim_tasks.rake +1 -83
- data/vendor/assets/javascripts/tribute.js +307 -145
- metadata +156 -22
- data/app/cells/decidim/conversation/show.erb +0 -18
- data/app/cells/decidim/conversation_cell.rb +0 -23
- data/app/cells/decidim/conversation_header/show.erb +0 -17
- data/app/cells/decidim/conversation_header_cell.rb +0 -16
- data/app/cells/decidim/conversations/show.erb +0 -45
- data/app/cells/decidim/conversations_cell.rb +0 -24
- data/app/cells/decidim/message/show.erb +0 -15
- data/app/cells/decidim/message_cell.rb +0 -23
- data/app/cells/decidim/new_conversation/show.erb +0 -19
- data/app/cells/decidim/new_conversation_cell.rb +0 -19
- data/app/views/decidim/pages/decidim_page.html.erb +0 -31
- data/app/views/decidim/searches/_results.html.erb +0 -5
- data/app/views/decidim/shared/_author_reference.html.erb +0 -1
@@ -11,12 +11,13 @@ module Decidim
|
|
11
11
|
# key - The key to translate.
|
12
12
|
# locales - A list of locales to scope the translations to. Picks up all the
|
13
13
|
# available locales by default.
|
14
|
+
# options - Any other option to delegate to the individual I18n.t calls
|
14
15
|
#
|
15
16
|
# Returns a Hash with the locales as keys and the translations as values.
|
16
|
-
def multi_translation(key, locales = Decidim.available_locales)
|
17
|
+
def multi_translation(key, locales = Decidim.available_locales, *options)
|
17
18
|
locales.each_with_object({}) do |locale, result|
|
18
19
|
I18n.with_locale(locale) do
|
19
|
-
result[locale.to_sym] = I18n.t(key)
|
20
|
+
result[locale.to_sym] = I18n.t(key, *options)
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
@@ -4,9 +4,11 @@ module Decidim
|
|
4
4
|
class EmailNotificationGeneratorJob < ApplicationJob
|
5
5
|
queue_as :events
|
6
6
|
|
7
|
-
|
7
|
+
# rubocop:disable Metrics/ParameterLists
|
8
|
+
def perform(event, event_class_name, resource, followers, affected_users, extra)
|
8
9
|
event_class = event_class_name.constantize
|
9
|
-
EmailNotificationGenerator.new(event, event_class, resource,
|
10
|
+
EmailNotificationGenerator.new(event, event_class, resource, followers, affected_users, extra).generate
|
10
11
|
end
|
12
|
+
# rubocop:enable Metrics/ParameterLists
|
11
13
|
end
|
12
14
|
end
|
@@ -7,7 +7,7 @@ module Decidim
|
|
7
7
|
def perform(manager_class, organization_id, day = nil)
|
8
8
|
organization = Decidim::Organization.find_by(id: organization_id)
|
9
9
|
return unless organization
|
10
|
-
metric = manager_class.constantize.
|
10
|
+
metric = manager_class.constantize.new(day, organization)
|
11
11
|
metric.save if metric.valid?
|
12
12
|
end
|
13
13
|
end
|
@@ -4,10 +4,10 @@ module Decidim
|
|
4
4
|
class NotificationGeneratorForRecipientJob < ApplicationJob
|
5
5
|
queue_as :events
|
6
6
|
|
7
|
-
def perform(event, event_class_name, resource,
|
7
|
+
def perform(event, event_class_name, resource, recipient, user_role, extra) # rubocop:disable Metrics/ParameterLists
|
8
8
|
event_class = event_class_name.constantize
|
9
9
|
NotificationGeneratorForRecipient
|
10
|
-
.new(event, event_class, resource,
|
10
|
+
.new(event, event_class, resource, recipient, user_role, extra)
|
11
11
|
.generate
|
12
12
|
end
|
13
13
|
end
|
@@ -4,9 +4,11 @@ module Decidim
|
|
4
4
|
class NotificationGeneratorJob < ApplicationJob
|
5
5
|
queue_as :events
|
6
6
|
|
7
|
-
|
7
|
+
# rubocop:disable Metrics/ParameterLists
|
8
|
+
def perform(event, event_class_name, resource, followers, affected_users, extra)
|
8
9
|
event_class = event_class_name.constantize
|
9
|
-
NotificationGenerator.new(event, event_class, resource,
|
10
|
+
NotificationGenerator.new(event, event_class, resource, followers, affected_users, extra).generate
|
10
11
|
end
|
12
|
+
# rubocop:enable Metrics/ParameterLists
|
11
13
|
end
|
12
14
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class OpenDataJob < ApplicationJob
|
5
|
+
queue_as :default
|
6
|
+
|
7
|
+
def perform(organization)
|
8
|
+
path = Rails.root.join("tmp/#{organization.open_data_file_path}")
|
9
|
+
|
10
|
+
exporter = OpenDataExporter.new(organization, path)
|
11
|
+
raise "Couldn't generate Open Data export" unless exporter.export.positive?
|
12
|
+
|
13
|
+
OpenDataUploader.new.store!(File.open(path, "rb"))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -10,27 +10,30 @@ module Decidim
|
|
10
10
|
from: originator,
|
11
11
|
to: user,
|
12
12
|
conversation: conversation,
|
13
|
+
message: conversation.messages.first.body,
|
13
14
|
action: "new_conversation"
|
14
15
|
)
|
15
16
|
end
|
16
17
|
|
17
|
-
def new_message(sender, user, conversation)
|
18
|
+
def new_message(sender, user, conversation, message)
|
18
19
|
notification_mail(
|
19
20
|
from: sender,
|
20
21
|
to: user,
|
21
22
|
conversation: conversation,
|
23
|
+
message: message.body,
|
22
24
|
action: "new_message"
|
23
25
|
)
|
24
26
|
end
|
25
27
|
|
26
28
|
private
|
27
29
|
|
28
|
-
def notification_mail(from:, to:, conversation:, action:)
|
30
|
+
def notification_mail(from:, to:, conversation:, action:, message: nil)
|
29
31
|
with_user(to) do
|
30
32
|
@organization = to.organization
|
31
33
|
@conversation = conversation
|
32
34
|
@sender = from.name
|
33
35
|
@recipient = to.name
|
36
|
+
@message = message
|
34
37
|
@host = @organization.host
|
35
38
|
|
36
39
|
subject = I18n.t(
|
@@ -16,9 +16,13 @@ module Decidim
|
|
16
16
|
|
17
17
|
@custom_url_for_mail_root = custom_url_for_mail_root(@organization, @newsletter.id) if Decidim.config.track_newsletter_links
|
18
18
|
@encrypted_token = Decidim::NewsletterEncryptor.sent_at_encrypted(@user.id, @newsletter.sent_at)
|
19
|
+
|
19
20
|
with_user(user) do
|
20
|
-
|
21
|
-
|
21
|
+
subject = @newsletter.subject[I18n.locale.to_s].presence || @newsletter.subject[@organization.default_locale]
|
22
|
+
body = @newsletter.body[I18n.locale.to_s].presence || @newsletter.body[@organization.default_locale]
|
23
|
+
|
24
|
+
@subject = parse_interpolations(subject, user, @newsletter.id)
|
25
|
+
@body = parse_interpolations(body, user, @newsletter.id)
|
22
26
|
|
23
27
|
mail(to: "#{user.name} <#{user.email}>", subject: @subject)
|
24
28
|
end
|
@@ -6,13 +6,13 @@ module Decidim
|
|
6
6
|
class NotificationMailer < Decidim::ApplicationMailer
|
7
7
|
helper Decidim::ResourceHelper
|
8
8
|
|
9
|
-
def event_received(event, event_class_name, resource, user, extra)
|
9
|
+
def event_received(event, event_class_name, resource, user, user_role, extra) # rubocop:disable Metrics/ParameterLists
|
10
10
|
return if user.email.blank?
|
11
11
|
|
12
12
|
with_user(user) do
|
13
13
|
@organization = user.organization
|
14
14
|
event_class = event_class_name.constantize
|
15
|
-
@event_instance = event_class.new(resource: resource, event_name: event, user: user, extra: extra)
|
15
|
+
@event_instance = event_class.new(resource: resource, event_name: event, user: user, extra: extra, user_role: user_role)
|
16
16
|
subject = @event_instance.email_subject
|
17
17
|
|
18
18
|
mail(to: user.email, subject: subject)
|
@@ -5,6 +5,8 @@ module Decidim
|
|
5
5
|
# for transparency reasons, to log all actions so all other users can
|
6
6
|
# see the actions being performed.
|
7
7
|
class ActionLog < ApplicationRecord
|
8
|
+
include Decidim::Scopable
|
9
|
+
|
8
10
|
belongs_to :organization,
|
9
11
|
foreign_key: :decidim_organization_id,
|
10
12
|
class_name: "Decidim::Organization"
|
@@ -30,6 +32,11 @@ module Decidim
|
|
30
32
|
optional: true,
|
31
33
|
class_name: "PaperTrail::Version"
|
32
34
|
|
35
|
+
belongs_to :area,
|
36
|
+
foreign_key: "decidim_area_id",
|
37
|
+
class_name: "Decidim::Area",
|
38
|
+
optional: true
|
39
|
+
|
33
40
|
validates :organization, :user, :action, presence: true
|
34
41
|
validates :resource, presence: true, if: ->(log) { log.action != "delete" }
|
35
42
|
validates :visibility, presence: true, inclusion: { in: %w(admin-only public-only all) }
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class Amendment < ApplicationRecord
|
5
|
+
belongs_to :amendable, foreign_key: "decidim_amendable_id", foreign_type: "decidim_amendable_type", polymorphic: true
|
6
|
+
belongs_to :amender, foreign_key: "decidim_user_id", class_name: "Decidim::User"
|
7
|
+
belongs_to :emendation, foreign_key: "decidim_emendation_id", foreign_type: "decidim_emendation_type", polymorphic: true
|
8
|
+
|
9
|
+
STATES = %w(evaluating accepted rejected withdrawn).freeze
|
10
|
+
|
11
|
+
def evaluating?
|
12
|
+
state == "evaluating"
|
13
|
+
end
|
14
|
+
|
15
|
+
validates :amendable, :amender, :emendation, presence: true
|
16
|
+
end
|
17
|
+
end
|
@@ -65,6 +65,14 @@ module Decidim
|
|
65
65
|
@primary_stat ||= manifest.stats.filter(primary: true).with_context([self]).map { |name, value| [name, value] }.first&.last
|
66
66
|
end
|
67
67
|
|
68
|
+
# Public: Returns the component's name as resource title
|
69
|
+
def resource_title
|
70
|
+
name
|
71
|
+
end
|
72
|
+
|
73
|
+
# Public: Returns an empty description
|
74
|
+
def resource_description; end
|
75
|
+
|
68
76
|
private
|
69
77
|
|
70
78
|
def participatory_space_name
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class ContextualHelpSection < ApplicationRecord
|
5
|
+
belongs_to :organization, class_name: "Decidim::Organization"
|
6
|
+
validates :organization, presence: true
|
7
|
+
validates :content, presence: true
|
8
|
+
|
9
|
+
# Public: Finds content given an id
|
10
|
+
#
|
11
|
+
# organization - The Organization to scope the content to
|
12
|
+
# id - A String with the id
|
13
|
+
#
|
14
|
+
# Returns a Hash with the localized content
|
15
|
+
def self.find_content(organization, id)
|
16
|
+
find_by(organization: organization, section_id: id).try(:content) || {}
|
17
|
+
end
|
18
|
+
|
19
|
+
# Public: Stores the content.
|
20
|
+
#
|
21
|
+
# organization - The Organization to scope the content to
|
22
|
+
# id - A String with the id
|
23
|
+
# content - A Hash with the content to store
|
24
|
+
#
|
25
|
+
# Returns a Hash with the localized content
|
26
|
+
def self.set_content(organization, id, content)
|
27
|
+
item = find_or_initialize_by(
|
28
|
+
organization: organization,
|
29
|
+
section_id: id
|
30
|
+
)
|
31
|
+
|
32
|
+
if content.present? && content.values.any?(&:present?)
|
33
|
+
item.update!(content: content)
|
34
|
+
else
|
35
|
+
item.destroy!
|
36
|
+
end
|
37
|
+
|
38
|
+
content
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -9,6 +9,12 @@ module Decidim
|
|
9
9
|
|
10
10
|
validates :user, uniqueness: { scope: [:followable] }
|
11
11
|
|
12
|
+
after_create :increase_following_counters
|
13
|
+
after_create :increase_followers_counter
|
14
|
+
|
15
|
+
after_destroy :decrease_following_counters
|
16
|
+
after_destroy :decrease_followers_counter
|
17
|
+
|
12
18
|
def self.user_collection(user)
|
13
19
|
where(decidim_user_id: user.id)
|
14
20
|
end
|
@@ -16,5 +22,29 @@ module Decidim
|
|
16
22
|
def self.export_serializer
|
17
23
|
Decidim::DataPortabilitySerializers::DataPortabilityFollowSerializer
|
18
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
# rubocop:disable Rails/SkipsModelValidations
|
29
|
+
def increase_following_counters
|
30
|
+
user.increment!(:following_count)
|
31
|
+
end
|
32
|
+
|
33
|
+
def increase_followers_counter
|
34
|
+
return unless followable.is_a?(Decidim::UserBaseEntity)
|
35
|
+
followable.increment!(:followers_count)
|
36
|
+
end
|
37
|
+
|
38
|
+
def decrease_following_counters
|
39
|
+
return unless user
|
40
|
+
user.decrement!(:following_count)
|
41
|
+
end
|
42
|
+
|
43
|
+
def decrease_followers_counter
|
44
|
+
return unless followable.is_a?(Decidim::UserBaseEntity)
|
45
|
+
return unless user
|
46
|
+
followable.decrement!(:followers_count)
|
47
|
+
end
|
48
|
+
# rubocop:enable Rails/SkipsModelValidations
|
19
49
|
end
|
20
50
|
end
|
@@ -8,7 +8,17 @@ module Decidim
|
|
8
8
|
belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User"
|
9
9
|
|
10
10
|
def event_class_instance
|
11
|
-
@event_class_instance ||= event_class.constantize.new(
|
11
|
+
@event_class_instance ||= event_class.constantize.new(
|
12
|
+
resource: resource,
|
13
|
+
event_name: event_name,
|
14
|
+
user: user,
|
15
|
+
user_role: user_role,
|
16
|
+
extra: extra
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def user_role
|
21
|
+
extra["received_as"]
|
12
22
|
end
|
13
23
|
|
14
24
|
def self.user_collection(user)
|
@@ -5,12 +5,14 @@ module Decidim
|
|
5
5
|
# installation we can find many organizations and each of them can start
|
6
6
|
# their own participatory processes.
|
7
7
|
class Organization < ApplicationRecord
|
8
|
+
include TranslationsHelper
|
8
9
|
include Decidim::Traceable
|
9
10
|
include Decidim::Loggable
|
10
11
|
|
11
12
|
SOCIAL_HANDLERS = [:twitter, :facebook, :instagram, :youtube, :github].freeze
|
12
13
|
|
13
14
|
has_many :static_pages, foreign_key: "decidim_organization_id", class_name: "Decidim::StaticPage", inverse_of: :organization, dependent: :destroy
|
15
|
+
has_many :static_page_topics, foreign_key: "organization_id", class_name: "Decidim::StaticPageTopic", inverse_of: :organization, dependent: :destroy
|
14
16
|
has_many :scopes, -> { order(name: :asc) }, foreign_key: "decidim_organization_id", class_name: "Decidim::Scope", inverse_of: :organization
|
15
17
|
has_many :scope_types, -> { order(name: :asc) }, foreign_key: "decidim_organization_id", class_name: "Decidim::ScopeType", inverse_of: :organization
|
16
18
|
has_many :areas, -> { order(name: :asc) }, foreign_key: "decidim_organization_id", class_name: "Decidim::Area", inverse_of: :organization
|
@@ -21,6 +23,12 @@ module Decidim
|
|
21
23
|
has_many :oauth_applications, foreign_key: "decidim_organization_id", class_name: "Decidim::OAuthApplication", inverse_of: :organization, dependent: :destroy
|
22
24
|
has_many :hashtags, foreign_key: "decidim_organization_id", class_name: "Decidim::Hashtag", dependent: :destroy
|
23
25
|
|
26
|
+
# Users registration mode. Whether users can register or access the system. Doesn't affect users that access through Omniauth integrations.
|
27
|
+
# enabled: Users registration and sign in are enabled (default value).
|
28
|
+
# existing: Users can't be registered in the system. Only existing users can sign in.
|
29
|
+
# disable: Users can't register or sign in.
|
30
|
+
enum users_registration_mode: [:enabled, :existing, :disabled], _prefix: true
|
31
|
+
|
24
32
|
validates :name, :host, uniqueness: true
|
25
33
|
validates :reference_prefix, presence: true
|
26
34
|
validates :default_locale, inclusion: { in: :available_locales }
|
@@ -55,5 +63,38 @@ module Decidim
|
|
55
63
|
def published_components
|
56
64
|
@published_components ||= Component.where(participatory_space: public_participatory_spaces).published
|
57
65
|
end
|
66
|
+
|
67
|
+
def customize_welcome_notification
|
68
|
+
self[:welcome_notification_subject].present? || self[:welcome_notification_body].present?
|
69
|
+
end
|
70
|
+
|
71
|
+
def welcome_notification_subject
|
72
|
+
self[:welcome_notification_subject] ||
|
73
|
+
multi_translation("decidim.welcome_notification.default_subject", available_locales)
|
74
|
+
end
|
75
|
+
|
76
|
+
def welcome_notification_body
|
77
|
+
self[:welcome_notification_body] ||
|
78
|
+
multi_translation("decidim.welcome_notification.default_body", available_locales)
|
79
|
+
end
|
80
|
+
|
81
|
+
def sign_up_enabled?
|
82
|
+
users_registration_mode_enabled?
|
83
|
+
end
|
84
|
+
|
85
|
+
def sign_in_enabled?
|
86
|
+
!users_registration_mode_disabled?
|
87
|
+
end
|
88
|
+
|
89
|
+
def open_data_file
|
90
|
+
@open_data_file ||= OpenDataUploader.new.tap do |uploader|
|
91
|
+
uploader.retrieve_from_store! open_data_file_path
|
92
|
+
uploader.cache! open_data_file_path
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def open_data_file_path
|
97
|
+
"#{host}-open-data.zip"
|
98
|
+
end
|
58
99
|
end
|
59
100
|
end
|
@@ -12,6 +12,7 @@ module Decidim
|
|
12
12
|
include Decidim::Loggable
|
13
13
|
|
14
14
|
belongs_to :organization, foreign_key: "decidim_organization_id", class_name: "Decidim::Organization", inverse_of: :static_pages
|
15
|
+
belongs_to :topic, foreign_key: "topic_id", class_name: "Decidim::StaticPageTopic", optional: true
|
15
16
|
|
16
17
|
validates :slug, presence: true, uniqueness: { scope: :organization }
|
17
18
|
validates :slug, format: { with: /\A[a-z0-9-]+/ }
|
@@ -20,9 +21,12 @@ module Decidim
|
|
20
21
|
# and cannot be deleted.
|
21
22
|
DEFAULT_PAGES = %w(faq terms-and-conditions accessibility).freeze
|
22
23
|
|
24
|
+
after_create :update_organization_tos_version
|
23
25
|
before_destroy :can_be_destroyed?
|
24
26
|
before_update :can_update_slug?
|
25
27
|
|
28
|
+
default_scope { order(arel_table[:weight].asc) }
|
29
|
+
|
26
30
|
# Whether this is slug of a default page or not.
|
27
31
|
#
|
28
32
|
# slug - The String with the value of the slug.
|
@@ -57,6 +61,13 @@ module Decidim
|
|
57
61
|
|
58
62
|
private
|
59
63
|
|
64
|
+
# When creating a terms-and-conditions page
|
65
|
+
# set the organization tos_version
|
66
|
+
def update_organization_tos_version
|
67
|
+
return unless slug == "terms-and-conditions"
|
68
|
+
organization.update!(tos_version: created_at)
|
69
|
+
end
|
70
|
+
|
60
71
|
def can_be_destroyed?
|
61
72
|
throw(:abort) if default?
|
62
73
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class StaticPageTopic < ApplicationRecord
|
5
|
+
validates :title, presence: true
|
6
|
+
|
7
|
+
default_scope { order(arel_table[:weight].asc) }
|
8
|
+
|
9
|
+
belongs_to :organization, class_name: "Decidim::Organization"
|
10
|
+
has_many :pages, class_name: "Decidim::StaticPage", foreign_key: "topic_id", dependent: :nullify
|
11
|
+
end
|
12
|
+
end
|
data/app/models/decidim/user.rb
CHANGED
@@ -138,9 +138,13 @@ module Decidim
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def tos_accepted?
|
141
|
-
return true if managed
|
141
|
+
return true if managed
|
142
142
|
return false if accepted_tos_version.nil?
|
143
|
-
|
143
|
+
|
144
|
+
# For some reason, if we don't use `#to_i` here we get some
|
145
|
+
# cases where the comparison returns false, but calling `#to_i` returns
|
146
|
+
# the same number :/
|
147
|
+
accepted_tos_version.to_i >= organization.tos_version.to_i
|
144
148
|
end
|
145
149
|
|
146
150
|
# Whether this user can be verified against some authorization or not.
|
@@ -152,6 +156,14 @@ module Decidim
|
|
152
156
|
ImpersonationLog.active.where(user: self).exists?
|
153
157
|
end
|
154
158
|
|
159
|
+
def interested_scopes_ids
|
160
|
+
extended_data["interested_scopes"] || []
|
161
|
+
end
|
162
|
+
|
163
|
+
def interested_scopes
|
164
|
+
@interested_scopes ||= organization.scopes.where(id: interested_scopes_ids)
|
165
|
+
end
|
166
|
+
|
155
167
|
protected
|
156
168
|
|
157
169
|
# Overrides devise email required validation.
|
@@ -168,6 +180,17 @@ module Decidim
|
|
168
180
|
super
|
169
181
|
end
|
170
182
|
|
183
|
+
def after_confirmation
|
184
|
+
return unless organization.send_welcome_notification?
|
185
|
+
|
186
|
+
Decidim::EventsManager.publish(
|
187
|
+
event: "decidim.events.core.welcome_notification",
|
188
|
+
event_class: WelcomeNotificationEvent,
|
189
|
+
resource: self,
|
190
|
+
affected_users: [self]
|
191
|
+
)
|
192
|
+
end
|
193
|
+
|
171
194
|
private
|
172
195
|
|
173
196
|
# Changes default Devise behaviour to use ActiveJob to send async emails.
|