decidim-admin 0.26.8 → 0.27.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-admin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/cells/decidim/admin/attachments_privacy_warning/show.erb +3 -0
- data/app/cells/decidim/admin/attachments_privacy_warning_cell.rb +19 -0
- data/app/commands/decidim/admin/block_user.rb +3 -8
- data/app/commands/decidim/admin/close_session_managed_user.rb +1 -1
- data/app/commands/decidim/admin/create_area.rb +1 -1
- data/app/commands/decidim/admin/create_area_type.rb +6 -3
- data/app/commands/decidim/admin/create_attachment.rb +14 -6
- data/app/commands/decidim/admin/create_attachment_collection.rb +13 -4
- data/app/commands/decidim/admin/create_category.rb +6 -4
- data/app/commands/decidim/admin/create_component.rb +1 -1
- data/app/commands/decidim/admin/create_import.rb +4 -5
- data/app/commands/decidim/admin/create_import_example.rb +1 -1
- data/app/commands/decidim/admin/create_newsletter.rb +1 -1
- data/app/commands/decidim/admin/create_participatory_space_private_user.rb +1 -1
- data/app/commands/decidim/admin/create_scope.rb +1 -1
- data/app/commands/decidim/admin/create_scope_type.rb +6 -3
- data/app/commands/decidim/admin/create_static_page.rb +1 -1
- data/app/commands/decidim/admin/create_static_page_topic.rb +1 -1
- data/app/commands/decidim/admin/deliver_newsletter.rb +6 -6
- data/app/commands/decidim/admin/destroy_area.rb +1 -1
- data/app/commands/decidim/admin/destroy_category.rb +6 -3
- data/app/commands/decidim/admin/destroy_component.rb +1 -1
- data/app/commands/decidim/admin/destroy_newsletter.rb +1 -1
- data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +1 -1
- data/app/commands/decidim/admin/destroy_scope.rb +1 -1
- data/app/commands/decidim/admin/destroy_share_token.rb +1 -1
- data/app/commands/decidim/admin/destroy_static_page.rb +1 -1
- data/app/commands/decidim/admin/destroy_static_page_topic.rb +1 -1
- data/app/commands/decidim/admin/hide_resource.rb +2 -2
- data/app/commands/decidim/admin/impersonate_user.rb +1 -1
- data/app/commands/decidim/admin/invite_admin.rb +1 -1
- data/app/commands/decidim/admin/officialize_user.rb +1 -1
- data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +7 -3
- data/app/commands/decidim/admin/process_user_group_verification_csv.rb +8 -4
- data/app/commands/decidim/admin/promote_managed_user.rb +1 -1
- data/app/commands/decidim/admin/publish_component.rb +2 -2
- data/app/commands/decidim/admin/reject_user_group.rb +1 -1
- data/app/commands/decidim/admin/remove_admin.rb +1 -1
- data/app/commands/decidim/admin/reorder_content_blocks.rb +1 -1
- data/app/commands/decidim/admin/transfer_user.rb +1 -1
- data/app/commands/decidim/admin/unblock_user.rb +2 -2
- data/app/commands/decidim/admin/unhide_resource.rb +1 -1
- data/app/commands/decidim/admin/unofficialize_user.rb +1 -1
- data/app/commands/decidim/admin/unpublish_component.rb +1 -1
- data/app/commands/decidim/admin/unreport_resource.rb +1 -1
- data/app/commands/decidim/admin/unreport_user.rb +1 -1
- data/app/commands/decidim/admin/update_area.rb +1 -1
- data/app/commands/decidim/admin/update_area_type.rb +8 -3
- data/app/commands/decidim/admin/update_attachment.rb +4 -3
- data/app/commands/decidim/admin/update_attachment_collection.rb +8 -3
- data/app/commands/decidim/admin/update_category.rb +9 -5
- data/app/commands/decidim/admin/update_component.rb +8 -5
- data/app/commands/decidim/admin/update_component_permissions.rb +9 -6
- data/app/commands/decidim/admin/update_content_block.rb +1 -1
- data/app/commands/decidim/admin/update_external_domain_whitelist.rb +6 -3
- data/app/commands/decidim/admin/update_help_sections.rb +17 -3
- data/app/commands/decidim/admin/update_newsletter.rb +1 -1
- data/app/commands/decidim/admin/update_organization.rb +1 -1
- data/app/commands/decidim/admin/update_organization_appearance.rb +1 -1
- data/app/commands/decidim/admin/update_organization_tos_version.rb +1 -1
- data/app/commands/decidim/admin/update_resource_permissions.rb +2 -2
- data/app/commands/decidim/admin/update_scope.rb +1 -1
- data/app/commands/decidim/admin/update_scope_type.rb +8 -3
- data/app/commands/decidim/admin/update_static_page.rb +1 -1
- data/app/commands/decidim/admin/update_static_page_topic.rb +1 -1
- data/app/commands/decidim/admin/update_user_groups.rb +1 -1
- data/app/commands/decidim/admin/verify_user_group.rb +1 -1
- data/app/controllers/concerns/decidim/admin/filterable.rb +1 -1
- data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +3 -1
- data/app/controllers/decidim/admin/admin_terms_controller.rb +1 -1
- data/app/controllers/decidim/admin/application_controller.rb +1 -1
- data/app/controllers/decidim/admin/area_types_controller.rb +6 -3
- data/app/controllers/decidim/admin/block_user_controller.rb +3 -3
- data/app/controllers/decidim/admin/categories_controller.rb +3 -3
- data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
- data/app/controllers/decidim/admin/components/base_controller.rb +1 -0
- data/app/controllers/decidim/admin/components_controller.rb +1 -1
- data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +6 -3
- data/app/controllers/decidim/admin/concerns/has_attachments.rb +6 -3
- data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +7 -0
- data/app/controllers/decidim/admin/dashboard_controller.rb +4 -3
- data/app/controllers/decidim/admin/exports_controller.rb +4 -1
- data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
- data/app/controllers/decidim/admin/metrics_controller.rb +2 -1
- data/app/controllers/decidim/admin/moderations_controller.rb +9 -7
- data/app/controllers/decidim/admin/newsletter_templates_controller.rb +1 -1
- data/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
- data/app/controllers/decidim/admin/organization_controller.rb +3 -4
- data/app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb +1 -1
- data/app/controllers/decidim/admin/reminders_controller.rb +61 -0
- data/app/controllers/decidim/admin/resource_permissions_controller.rb +3 -3
- data/app/controllers/decidim/admin/scope_types_controller.rb +6 -3
- data/app/controllers/decidim/admin/static_page_topics_controller.rb +3 -1
- data/app/controllers/decidim/admin/static_pages_controller.rb +1 -7
- data/app/forms/decidim/admin/block_user_form.rb +2 -2
- data/app/forms/decidim/admin/category_form.rb +1 -2
- data/app/forms/decidim/admin/component_form.rb +16 -7
- data/app/forms/decidim/admin/import_example_form.rb +1 -5
- data/app/forms/decidim/admin/import_form.rb +7 -10
- data/app/forms/decidim/admin/managed_user_promotion_form.rb +1 -1
- data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +7 -4
- data/app/forms/decidim/admin/permission_form.rb +9 -8
- data/app/forms/decidim/admin/permissions_form.rb +1 -10
- data/app/forms/decidim/admin/user_group_csv_verification_form.rb +2 -2
- data/app/helpers/decidim/admin/bulk_actions_helper.rb +6 -5
- data/app/helpers/decidim/admin/moderations/reports_helper.rb +11 -2
- data/app/helpers/decidim/admin/reminders_helper.rb +12 -0
- data/app/helpers/decidim/admin/settings_helper.rb +11 -57
- data/app/models/decidim/admin/fake_newsletter.rb +0 -20
- data/app/packs/entrypoints/decidim_admin.js +3 -6
- data/app/packs/src/decidim/admin/admin_autocomplete.js +82 -0
- data/app/packs/src/decidim/admin/application.js +0 -16
- data/app/packs/src/decidim/admin/choose_language.js +9 -11
- data/app/packs/src/decidim/admin/draggable-list.js +1 -1
- data/app/packs/src/decidim/admin/dynamic_fields.component.js +0 -1
- data/app/packs/stylesheets/decidim/admin/_decidim.scss +0 -1
- data/app/packs/stylesheets/decidim/admin/extra/_quill.scss +0 -7
- data/app/packs/stylesheets/decidim/admin/modules/_autocomplete.scss +5 -0
- data/app/packs/stylesheets/decidim/admin/modules/_forms.scss +0 -6
- data/app/packs/stylesheets/decidim/admin/modules/_import_result.scss +10 -0
- data/app/packs/stylesheets/decidim/admin/modules/_modules.scss +3 -0
- data/app/packs/stylesheets/decidim/admin/modules/_upload_modal.scss +42 -0
- data/app/permissions/decidim/admin/permissions.rb +4 -46
- data/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb +3 -1
- data/app/queries/decidim/admin/active_users_counter.rb +1 -1
- data/app/queries/decidim/admin/newsletter_recipients.rb +2 -2
- data/app/queries/decidim/admin/user_filter.rb +1 -1
- data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
- data/app/views/decidim/admin/area_types/edit.html.erb +0 -1
- data/app/views/decidim/admin/area_types/index.html.erb +0 -1
- data/app/views/decidim/admin/area_types/new.html.erb +0 -1
- data/app/views/decidim/admin/areas/edit.html.erb +0 -1
- data/app/views/decidim/admin/areas/index.html.erb +0 -1
- data/app/views/decidim/admin/areas/new.html.erb +0 -1
- data/app/views/decidim/admin/attachment_collections/edit.html.erb +0 -1
- data/app/views/decidim/admin/attachment_collections/index.html.erb +0 -1
- data/app/views/decidim/admin/attachment_collections/new.html.erb +0 -1
- data/app/views/decidim/admin/attachments/edit.html.erb +0 -1
- data/app/views/decidim/admin/attachments/index.html.erb +1 -1
- data/app/views/decidim/admin/attachments/new.html.erb +0 -1
- data/app/views/decidim/admin/authorization_workflows/index.html.erb +0 -1
- data/app/views/decidim/admin/categories/_form.html.erb +0 -4
- data/app/views/decidim/admin/categories/edit.html.erb +0 -1
- data/app/views/decidim/admin/categories/index.html.erb +0 -1
- data/app/views/decidim/admin/categories/new.html.erb +0 -1
- data/app/views/decidim/admin/categories/show.html.erb +1 -2
- data/app/views/decidim/admin/components/edit.html.erb +0 -1
- data/app/views/decidim/admin/components/index.html.erb +0 -1
- data/app/views/decidim/admin/components/new.html.erb +1 -1
- data/app/views/decidim/admin/conflicts/index.html.erb +0 -1
- data/app/views/decidim/admin/dashboard/show.html.erb +1 -1
- data/app/views/decidim/admin/help_sections/show.erb +0 -1
- data/app/views/decidim/admin/impersonatable_users/index.html.erb +0 -1
- data/app/views/decidim/admin/impersonations/new.html.erb +0 -1
- data/app/views/decidim/admin/imports/new.html.erb +1 -1
- data/app/views/decidim/admin/logs/index.html.erb +0 -1
- data/app/views/decidim/admin/moderated_users/index.html.erb +1 -2
- data/app/views/decidim/admin/moderations/index.html.erb +4 -9
- data/app/views/decidim/admin/moderations/reports/index.html.erb +1 -5
- data/app/views/decidim/admin/newsletter_templates/index.html.erb +0 -1
- data/app/views/decidim/admin/newsletter_templates/show.html.erb +0 -1
- data/app/views/decidim/admin/newsletters/index.html.erb +0 -1
- data/app/views/decidim/admin/newsletters/new.html.erb +0 -1
- data/app/views/decidim/admin/newsletters/show.html.erb +0 -1
- data/app/views/decidim/admin/officializations/index.html.erb +10 -15
- data/app/views/decidim/admin/officializations/new.html.erb +0 -1
- data/app/views/decidim/admin/organization/edit.html.erb +0 -1
- data/app/views/decidim/admin/organization_appearance/edit.html.erb +0 -1
- data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -4
- data/app/views/decidim/admin/organization_external_domain_whitelist/edit.html.erb +0 -1
- data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +1 -1
- data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +20 -1
- data/app/views/decidim/admin/reminders/new.html.erb +21 -0
- data/app/views/decidim/admin/resource_permissions/edit.html.erb +1 -1
- data/app/views/decidim/admin/scope_types/edit.html.erb +0 -1
- data/app/views/decidim/admin/scope_types/index.html.erb +0 -1
- data/app/views/decidim/admin/scope_types/new.html.erb +0 -1
- data/app/views/decidim/admin/scopes/edit.html.erb +0 -1
- data/app/views/decidim/admin/scopes/index.html.erb +0 -1
- data/app/views/decidim/admin/scopes/new.html.erb +0 -1
- data/app/views/decidim/admin/shared/_gallery.html.erb +6 -1
- data/app/views/decidim/admin/shared/_js-callout.html.erb +6 -0
- data/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb +0 -1
- data/app/views/decidim/admin/static_page_topics/edit.html.erb +0 -1
- data/app/views/decidim/admin/static_page_topics/new.html.erb +0 -1
- data/app/views/decidim/admin/static_pages/_form.html.erb +1 -1
- data/app/views/decidim/admin/static_pages/edit.html.erb +0 -1
- data/app/views/decidim/admin/static_pages/index.html.erb +0 -1
- data/app/views/decidim/admin/static_pages/new.html.erb +0 -1
- data/app/views/decidim/admin/user_groups/index.html.erb +0 -1
- data/app/views/decidim/admin/user_groups_csv_verifications/new.html.erb +0 -1
- data/app/views/decidim/admin/users/index.html.erb +0 -1
- data/app/views/decidim/admin/users/new.html.erb +0 -1
- data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
- data/app/views/layouts/decidim/admin/_application.html.erb +2 -0
- data/app/views/layouts/decidim/admin/global_moderations.html.erb +0 -1
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +33 -31
- data/config/locales/bg.yml +1 -0
- data/config/locales/ca.yml +32 -29
- data/config/locales/cs.yml +43 -38
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +28 -28
- data/config/locales/el.yml +4 -64
- data/config/locales/en.yml +25 -23
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +29 -26
- data/config/locales/es-PY.yml +29 -26
- data/config/locales/es.yml +32 -29
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +22 -40
- data/config/locales/fi-plain.yml +28 -25
- data/config/locales/fi.yml +33 -30
- data/config/locales/fr-CA.yml +28 -25
- data/config/locales/fr.yml +43 -40
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +22 -4
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +35 -222
- data/config/locales/id-ID.yml +4 -7
- data/config/locales/is-IS.yml +5 -8
- data/config/locales/it.yml +13 -6
- data/config/locales/ja.yml +32 -30
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +7 -5
- data/config/locales/lt.yml +18 -141
- data/config/locales/lv.yml +6 -4
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +8 -66
- data/config/locales/no.yml +18 -10
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +26 -6
- data/config/locales/pt-BR.yml +7 -69
- data/config/locales/pt.yml +7 -5
- data/config/locales/ro-RO.yml +21 -36
- data/config/locales/ru.yml +4 -7
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +6 -4
- data/config/locales/sl.yml +1 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +5 -10
- data/config/locales/sv.yml +30 -18
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +7 -8
- data/config/locales/uk.yml +4 -6
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +6 -4
- data/config/locales/zh-TW.yml +1 -1075
- data/lib/decidim/admin/engine.rb +1 -12
- data/lib/decidim/admin/form_builder.rb +2 -1
- data/lib/decidim/admin/import/importer.rb +9 -7
- data/lib/decidim/admin/import/readers/json.rb +1 -1
- data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +15 -2
- data/lib/decidim/admin/test/commands/create_category_examples.rb +16 -6
- data/lib/decidim/admin/test/commands/destroy_category_examples.rb +29 -1
- data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +15 -2
- data/lib/decidim/admin/test/commands/update_category_examples.rb +16 -6
- data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +4 -4
- data/lib/decidim/admin/test/filters_participatory_space_users_examples.rb +4 -4
- data/lib/decidim/admin/test/forms/category_form_examples.rb +1 -21
- data/lib/decidim/admin/test/manage_attachments_examples.rb +9 -2
- data/lib/decidim/admin/test/manage_categories_examples.rb +0 -10
- data/lib/decidim/admin/test/manage_component_permissions_examples.rb +0 -2
- data/lib/decidim/admin/test/manage_moderations_examples.rb +27 -79
- data/lib/decidim/admin/test.rb +0 -1
- data/lib/decidim/admin/version.rb +1 -1
- metadata +22 -25
- data/app/controllers/concerns/decidim/admin/needs_admin_tos_accepted.rb +0 -42
- data/app/controllers/decidim/admin/space_publications_controller.rb +0 -63
- data/app/packs/src/decidim/admin/autocomplete.component.js +0 -146
- data/app/packs/src/decidim/admin/autocomplete.component.test.js +0 -19
- data/app/packs/stylesheets/decidim/admin/components/_autocomplete_select.component.scss +0 -19
- data/config/environment.rb +0 -1
- data/config/locales/fa-IR.yml +0 -1
- data/config/locales/gn-PY.yml +0 -1
- data/config/locales/ka-GE.yml +0 -1
- data/config/locales/kaa.yml +0 -200
- data/config/locales/lo-LA.yml +0 -1
- data/config/locales/oc-FR.yml +0 -1
- data/lib/decidim/admin/test/needs_admin_tos_accepted_examples.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd57dbd303809b47c0bbf9c466c4ed731f6e3d4c8b6604d1adb478114f5ef0cb
|
4
|
+
data.tar.gz: e77d08a54416dbff1d3481d3ddf32de28828d475143ff5cb4b5c536114106c45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b97e7a0cdb53e8c909c42e7fc6b2cd345f66f61c67648a3c086ad2db8ba9e9dc936e60d51cfaf7689d086d4c9a1f347b2432f22f9e7590743bec4897c278cf17
|
7
|
+
data.tar.gz: 96cb283bb59d1026e5de9d917db4dbf185ef5384442a9166f1211077c757554d6680dec253d1408da3924ae381b9dfcbb590f50c1cd73bd80b5120c4cd1cba78
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
class AttachmentsPrivacyWarningCell < Decidim::ViewModel
|
6
|
+
delegate :current_participatory_space, to: :controller
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def private_space?
|
11
|
+
current_participatory_space.private_space if current_participatory_space.respond_to?(:private_space)
|
12
|
+
end
|
13
|
+
|
14
|
+
def transparent_space?
|
15
|
+
current_participatory_space.is_transparent if current_participatory_space.respond_to?(:is_transparent)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
|
-
class BlockUser <
|
5
|
+
class BlockUser < Decidim::Command
|
6
6
|
# Public: Initializes the command.
|
7
7
|
#
|
8
8
|
# form - BlockUserForm
|
@@ -20,9 +20,8 @@ module Decidim
|
|
20
20
|
return broadcast(:invalid) unless form.valid?
|
21
21
|
|
22
22
|
transaction do
|
23
|
-
find_or_create_moderation!
|
24
|
-
register_justification!
|
25
23
|
block!
|
24
|
+
register_justification!
|
26
25
|
notify_user!
|
27
26
|
end
|
28
27
|
|
@@ -33,10 +32,6 @@ module Decidim
|
|
33
32
|
|
34
33
|
attr_reader :form
|
35
34
|
|
36
|
-
def find_or_create_moderation!
|
37
|
-
Decidim::UserModeration.create_or_find_by!(user: form.user)
|
38
|
-
end
|
39
|
-
|
40
35
|
def register_justification!
|
41
36
|
@current_blocking = UserBlock.create!(
|
42
37
|
justification: form.justification,
|
@@ -70,7 +65,7 @@ module Decidim
|
|
70
65
|
) do
|
71
66
|
form.user.blocked = true
|
72
67
|
form.user.blocked_at = Time.current
|
73
|
-
form.user.
|
68
|
+
form.user.blocking = @current_blocking
|
74
69
|
form.user.extended_data["user_name"] = form.user.name
|
75
70
|
form.user.name = "Blocked user"
|
76
71
|
form.user.save!
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic to close a current impersonation session.
|
6
|
-
class CloseSessionManagedUser <
|
6
|
+
class CloseSessionManagedUser < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# user - The user impersonated.
|
@@ -3,12 +3,13 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic when creating an area type.
|
6
|
-
class CreateAreaType <
|
6
|
+
class CreateAreaType < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# form - A form object with the params.
|
10
|
-
def initialize(form)
|
10
|
+
def initialize(form, user)
|
11
11
|
@form = form
|
12
|
+
@user = user
|
12
13
|
end
|
13
14
|
|
14
15
|
# Executes the command. Broadcasts these events:
|
@@ -29,7 +30,9 @@ module Decidim
|
|
29
30
|
attr_reader :form
|
30
31
|
|
31
32
|
def create_area_type
|
32
|
-
|
33
|
+
Decidim.traceability.create!(
|
34
|
+
AreaType,
|
35
|
+
@user,
|
33
36
|
name: form.name,
|
34
37
|
organization: form.organization,
|
35
38
|
plural: form.plural
|
@@ -4,14 +4,15 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic to add an attachment to a
|
6
6
|
# participatory process.
|
7
|
-
class CreateAttachment <
|
7
|
+
class CreateAttachment < Decidim::Command
|
8
8
|
# Public: Initializes the command.
|
9
9
|
#
|
10
10
|
# form - A form object with the params.
|
11
11
|
# attached_to - The ActiveRecord::Base that will hold the attachment
|
12
|
-
def initialize(form, attached_to)
|
12
|
+
def initialize(form, attached_to, user)
|
13
13
|
@form = form
|
14
14
|
@attached_to = attached_to
|
15
|
+
@user = user
|
15
16
|
end
|
16
17
|
|
17
18
|
# Executes the command. Broadcasts these events:
|
@@ -26,9 +27,12 @@ module Decidim
|
|
26
27
|
build_attachment
|
27
28
|
|
28
29
|
if @attachment.valid?
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
Decidim.traceability.perform_action!(:create, Decidim::Attachment, @user) do
|
31
|
+
@attachment.save!
|
32
|
+
notify_followers
|
33
|
+
broadcast(:ok)
|
34
|
+
@attachment
|
35
|
+
end
|
32
36
|
else
|
33
37
|
@form.errors.add :file, @attachment.errors[:file] if @attachment.errors.has_key? :file
|
34
38
|
broadcast(:invalid)
|
@@ -47,7 +51,7 @@ module Decidim
|
|
47
51
|
weight: form.weight,
|
48
52
|
attachment_collection: form.attachment_collection,
|
49
53
|
file: form.file, # Define attached_to before this
|
50
|
-
content_type: form.file.content_type
|
54
|
+
content_type: blob(form.file).content_type
|
51
55
|
)
|
52
56
|
end
|
53
57
|
|
@@ -61,6 +65,10 @@ module Decidim
|
|
61
65
|
followers: @attachment.attached_to.followers
|
62
66
|
)
|
63
67
|
end
|
68
|
+
|
69
|
+
def blob(signed_id)
|
70
|
+
ActiveStorage::Blob.find_signed(signed_id)
|
71
|
+
end
|
64
72
|
end
|
65
73
|
end
|
66
74
|
end
|
@@ -4,14 +4,15 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic to add an attachment collection
|
6
6
|
# to a participatory space.
|
7
|
-
class CreateAttachmentCollection <
|
7
|
+
class CreateAttachmentCollection < Decidim::Command
|
8
8
|
# Public: Initializes the command.
|
9
9
|
#
|
10
10
|
# form - A form object with the params.
|
11
11
|
# collection_for - The ActiveRecord::Base that will hold the collection
|
12
|
-
def initialize(form, collection_for)
|
12
|
+
def initialize(form, collection_for, user)
|
13
13
|
@form = form
|
14
14
|
@collection_for = collection_for
|
15
|
+
@user = user
|
15
16
|
end
|
16
17
|
|
17
18
|
# Executes the command. Broadcasts these events:
|
@@ -32,12 +33,20 @@ module Decidim
|
|
32
33
|
attr_reader :form
|
33
34
|
|
34
35
|
def create_attachment_collection
|
35
|
-
|
36
|
+
Decidim.traceability.create!(
|
37
|
+
AttachmentCollection,
|
38
|
+
@user,
|
39
|
+
attributes
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def attributes
|
44
|
+
{
|
36
45
|
name: form.name,
|
37
46
|
weight: form.weight,
|
38
47
|
description: form.description,
|
39
48
|
collection_for: @collection_for
|
40
|
-
|
49
|
+
}
|
41
50
|
end
|
42
51
|
end
|
43
52
|
end
|
@@ -4,15 +4,16 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic to create a new category in the
|
6
6
|
# system.
|
7
|
-
class CreateCategory <
|
7
|
+
class CreateCategory < Decidim::Command
|
8
8
|
# Public: Initializes the command.
|
9
9
|
#
|
10
10
|
# form - A form object with the params.
|
11
11
|
# participatory_space - The participatory space that will hold the
|
12
12
|
# category
|
13
|
-
def initialize(form, participatory_space)
|
13
|
+
def initialize(form, participatory_space, user)
|
14
14
|
@form = form
|
15
15
|
@participatory_space = participatory_space
|
16
|
+
@user = user
|
16
17
|
end
|
17
18
|
|
18
19
|
# Executes the command. Broadcasts these events:
|
@@ -33,10 +34,11 @@ module Decidim
|
|
33
34
|
attr_reader :form
|
34
35
|
|
35
36
|
def create_category
|
36
|
-
|
37
|
+
Decidim.traceability.create!(
|
38
|
+
Category,
|
39
|
+
@user,
|
37
40
|
name: form.name,
|
38
41
|
weight: form.weight,
|
39
|
-
description: form.description,
|
40
42
|
parent_id: form.parent_id,
|
41
43
|
participatory_space: @participatory_space
|
42
44
|
)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# This command gets called when a component is created from the admin panel.
|
6
|
-
class CreateComponent <
|
6
|
+
class CreateComponent < Decidim::Command
|
7
7
|
attr_reader :form, :manifest, :participatory_space
|
8
8
|
|
9
9
|
# Public: Initializes the command.
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
|
-
class CreateImport <
|
5
|
+
class CreateImport < Decidim::Command
|
6
6
|
def initialize(form)
|
7
7
|
@form = form
|
8
8
|
end
|
@@ -14,13 +14,12 @@ module Decidim
|
|
14
14
|
transaction do
|
15
15
|
form.importer.import!
|
16
16
|
|
17
|
-
|
17
|
+
broadcast(:ok, imported_data)
|
18
18
|
rescue StandardError
|
19
|
+
# Something went wrong with import/finish
|
20
|
+
broadcast(:invalid)
|
19
21
|
raise ActiveRecord::Rollback
|
20
22
|
end
|
21
|
-
|
22
|
-
# Something went wrong with import/finish
|
23
|
-
broadcast(:invalid)
|
24
23
|
end
|
25
24
|
|
26
25
|
attr_reader :form
|
@@ -4,7 +4,7 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# Creates a newsletter and assigns the right author and
|
6
6
|
# organization.
|
7
|
-
class CreateNewsletter <
|
7
|
+
class CreateNewsletter < Decidim::Command
|
8
8
|
# Initializes the command.
|
9
9
|
#
|
10
10
|
# form - The source fo data for this newsletter.
|
@@ -4,7 +4,7 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic when creating a new participatory space
|
6
6
|
# private user in the system.
|
7
|
-
class CreateParticipatorySpacePrivateUser <
|
7
|
+
class CreateParticipatorySpacePrivateUser < Decidim::Command
|
8
8
|
# Public: Initializes the command.
|
9
9
|
#
|
10
10
|
# form - A form object with the params.
|
@@ -3,12 +3,13 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic when creating a scope type.
|
6
|
-
class CreateScopeType <
|
6
|
+
class CreateScopeType < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# form - A form object with the params.
|
10
|
-
def initialize(form)
|
10
|
+
def initialize(form, user)
|
11
11
|
@form = form
|
12
|
+
@user = user
|
12
13
|
end
|
13
14
|
|
14
15
|
# Executes the command. Broadcasts these events:
|
@@ -29,7 +30,9 @@ module Decidim
|
|
29
30
|
attr_reader :form
|
30
31
|
|
31
32
|
def create_scope_type
|
32
|
-
|
33
|
+
Decidim.traceability.create!(
|
34
|
+
ScopeType,
|
35
|
+
@user,
|
33
36
|
name: form.name,
|
34
37
|
organization: form.organization,
|
35
38
|
plural: form.plural
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic when creating a static page.
|
6
|
-
class CreateStaticPage <
|
6
|
+
class CreateStaticPage < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# form - A form object with the params.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic when creating a static page topic.
|
6
|
-
class CreateStaticPageTopic <
|
6
|
+
class CreateStaticPageTopic < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# form - A form object with the params.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# Delivers the newsletter to its recipients.
|
6
|
-
class DeliverNewsletter <
|
6
|
+
class DeliverNewsletter < Decidim::Command
|
7
7
|
# Initializes the command.
|
8
8
|
#
|
9
9
|
# newsletter - The newsletter to deliver.
|
@@ -16,12 +16,12 @@ module Decidim
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def call
|
19
|
-
@
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
return broadcast(:no_recipients) if recipients.blank?
|
19
|
+
return broadcast(:invalid) if @form.send_to_all_users && !@user.admin?
|
20
|
+
return broadcast(:invalid) unless @form.valid?
|
21
|
+
return broadcast(:invalid) if @newsletter.sent?
|
22
|
+
return broadcast(:no_recipients) if recipients.blank?
|
24
23
|
|
24
|
+
@newsletter.with_lock do
|
25
25
|
send_newsletter!
|
26
26
|
end
|
27
27
|
|
@@ -4,12 +4,13 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic to destroy a category in the
|
6
6
|
# system.
|
7
|
-
class DestroyCategory <
|
7
|
+
class DestroyCategory < Decidim::Command
|
8
8
|
# Public: Initializes the command.
|
9
9
|
#
|
10
10
|
# category - A Category that will be destroyed
|
11
|
-
def initialize(category)
|
11
|
+
def initialize(category, user)
|
12
12
|
@category = category
|
13
|
+
@user = user
|
13
14
|
end
|
14
15
|
|
15
16
|
# Executes the command. Broadcasts these events:
|
@@ -30,7 +31,9 @@ module Decidim
|
|
30
31
|
attr_reader :category
|
31
32
|
|
32
33
|
def destroy_category
|
33
|
-
|
34
|
+
Decidim.traceability.perform_action!(:delete, category, @user) do
|
35
|
+
category.destroy!
|
36
|
+
end
|
34
37
|
end
|
35
38
|
end
|
36
39
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# This command deals with destroying a Component from the admin panel.
|
6
|
-
class DestroyComponent <
|
6
|
+
class DestroyComponent < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# component - The Component to be destroyed.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# This command deals with destroying a newsletter from the admin panel.
|
6
|
-
class DestroyNewsletter <
|
6
|
+
class DestroyNewsletter < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# newsletter - The Newsletter to be destroyed.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic to destroy a participatory space private user.
|
6
|
-
class DestroyParticipatorySpacePrivateUser <
|
6
|
+
class DestroyParticipatorySpacePrivateUser < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# participatory_space_private_user - The participatory space private user to destroy
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic to destroy a share token.
|
6
|
-
class DestroyShareToken <
|
6
|
+
class DestroyShareToken < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# share_token - The share_token to destroy
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# This command deals with destroying a StaticPage from the admin panel.
|
6
|
-
class DestroyStaticPage <
|
6
|
+
class DestroyStaticPage < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# page - The StaticPage to be destroyed.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# This command deals with destroying a StaticPageTopic from the admin panel.
|
6
|
-
class DestroyStaticPageTopic <
|
6
|
+
class DestroyStaticPageTopic < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# page - The StaticPageTopic to be destroyed.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic when a user hides a resource.
|
6
|
-
class HideResource <
|
6
|
+
class HideResource < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# reportable - A Decidim::Reportable
|
@@ -60,7 +60,7 @@ module Decidim
|
|
60
60
|
affected_users: @reportable.try(:authors) || [@reportable.try(:normalized_author)]
|
61
61
|
}
|
62
62
|
|
63
|
-
Decidim::EventsManager.publish(data)
|
63
|
+
Decidim::EventsManager.publish(**data)
|
64
64
|
end
|
65
65
|
|
66
66
|
def report_reasons
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic to impersonate a managed user.
|
6
|
-
class ImpersonateUser <
|
6
|
+
class ImpersonateUser < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# form - The form with the authorization info
|
@@ -4,7 +4,9 @@ require "csv"
|
|
4
4
|
|
5
5
|
module Decidim
|
6
6
|
module Admin
|
7
|
-
class ProcessParticipatorySpacePrivateUserImportCsv <
|
7
|
+
class ProcessParticipatorySpacePrivateUserImportCsv < Decidim::Command
|
8
|
+
include Decidim::ProcessesFileLocally
|
9
|
+
|
8
10
|
# Public: Initializes the command.
|
9
11
|
#
|
10
12
|
# form - the form object containing the uploaded file
|
@@ -32,8 +34,10 @@ module Decidim
|
|
32
34
|
private
|
33
35
|
|
34
36
|
def process_csv
|
35
|
-
|
36
|
-
|
37
|
+
process_file_locally(@form.file) do |file_path|
|
38
|
+
CSV.foreach(file_path, encoding: "BOM|UTF-8") do |email, user_name|
|
39
|
+
ImportParticipatorySpacePrivateUserCsvJob.perform_later(email, user_name, @private_users_to, @current_user) if email.present? && user_name.present?
|
40
|
+
end
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
@@ -6,7 +6,9 @@ module Decidim
|
|
6
6
|
module Admin
|
7
7
|
# A command with all the business logic when processing the CSV to verify
|
8
8
|
# user groups.
|
9
|
-
class ProcessUserGroupVerificationCsv <
|
9
|
+
class ProcessUserGroupVerificationCsv < Decidim::Command
|
10
|
+
include Decidim::ProcessesFileLocally
|
11
|
+
|
10
12
|
# Public: Initializes the command.
|
11
13
|
#
|
12
14
|
# form - the form object containing the uploaded file
|
@@ -33,9 +35,11 @@ module Decidim
|
|
33
35
|
verifier = @form.current_user
|
34
36
|
organization = @form.current_organization
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
process_file_locally(@form.file) do |file_path|
|
39
|
+
CSV.foreach(file_path) do |row|
|
40
|
+
email = row[0]
|
41
|
+
VerifyUserGroupFromCsvJob.perform_later(email, verifier, organization) if email.present?
|
42
|
+
end
|
39
43
|
end
|
40
44
|
end
|
41
45
|
end
|
@@ -7,7 +7,7 @@ module Decidim
|
|
7
7
|
# Managed users can be promoted to standard users. It means they
|
8
8
|
# will be invited to the application and will lose the managed flag
|
9
9
|
# so the user cannot be impersonated anymore.
|
10
|
-
class PromoteManagedUser <
|
10
|
+
class PromoteManagedUser < Decidim::Command
|
11
11
|
# Public: Initializes the command.
|
12
12
|
#
|
13
13
|
# form - A form object with the params.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# This command gets called when a component is published from the admin panel.
|
6
|
-
class PublishComponent <
|
6
|
+
class PublishComponent < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# component - The component to publish.
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
# Broadcasts :ok if published, :invalid otherwise.
|
19
19
|
def call
|
20
20
|
publish_component
|
21
|
-
publish_event
|
21
|
+
publish_event
|
22
22
|
|
23
23
|
broadcast(:ok)
|
24
24
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
5
|
# A command with all the business logic when rejecting a user_group.
|
6
|
-
class RejectUserGroup <
|
6
|
+
class RejectUserGroup < Decidim::Command
|
7
7
|
# Public: Initializes the command.
|
8
8
|
#
|
9
9
|
# user_group - The user_group to reject
|