decidim-admin 0.26.2 → 0.27.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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/application_controller.rb +1 -0
- data/app/controllers/decidim/admin/area_types_controller.rb +6 -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/organization_controller.rb +3 -3
- 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_pages_controller.rb +1 -7
- 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 +0 -4
- 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 +57 -11
- data/app/packs/entrypoints/decidim_admin.js +7 -2
- data/app/packs/src/decidim/admin/admin_autocomplete.js +86 -0
- data/app/packs/src/decidim/admin/application.js +0 -16
- data/app/packs/src/decidim/admin/choose_language.js +11 -9
- data/app/packs/src/decidim/admin/dynamic_fields.component.js +1 -0
- data/app/packs/stylesheets/decidim/admin/_decidim.scss +0 -1
- data/app/packs/stylesheets/decidim/admin/modules/_autocomplete.scss +5 -0
- data/app/packs/stylesheets/decidim/admin/modules/_forms.scss +6 -0
- data/app/packs/stylesheets/decidim/admin/modules/_modules.scss +2 -0
- data/app/packs/stylesheets/decidim/admin/modules/_upload_modal.scss +42 -0
- data/app/permissions/decidim/admin/permissions.rb +1 -0
- 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/attachments/index.html.erb +1 -0
- data/app/views/decidim/admin/categories/_form.html.erb +0 -4
- data/app/views/decidim/admin/categories/show.html.erb +1 -2
- data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -4
- 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/shared/_gallery.html.erb +6 -1
- data/app/views/decidim/admin/shared/_js-callout.html.erb +6 -0
- 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/config/locales/ar.yml +15 -4
- data/config/locales/bg.yml +1 -0
- data/config/locales/ca.yml +22 -4
- data/config/locales/cs.yml +24 -4
- data/config/locales/de.yml +22 -4
- data/config/locales/el.yml +1 -5
- data/config/locales/en.yml +21 -4
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +22 -4
- data/config/locales/es-PY.yml +22 -4
- data/config/locales/es.yml +22 -4
- data/config/locales/eu.yml +1 -5
- data/config/locales/fi-plain.yml +22 -4
- data/config/locales/fi.yml +22 -4
- data/config/locales/fr-CA.yml +22 -4
- data/config/locales/fr.yml +36 -18
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +16 -4
- data/config/locales/hu.yml +196 -3
- data/config/locales/id-ID.yml +1 -3
- data/config/locales/is-IS.yml +2 -4
- data/config/locales/it.yml +6 -5
- data/config/locales/ja.yml +21 -4
- data/config/locales/lb.yml +1 -5
- data/config/locales/lt.yml +994 -0
- data/config/locales/lv.yml +1 -3
- data/config/locales/nl.yml +83 -5
- data/config/locales/no.yml +27 -4
- data/config/locales/pl.yml +77 -5
- data/config/locales/pt-BR.yml +1 -5
- data/config/locales/pt.yml +1 -5
- data/config/locales/ro-RO.yml +7 -5
- data/config/locales/ru.yml +1 -3
- data/config/locales/sk.yml +1 -3
- data/config/locales/sl.yml +1 -0
- data/config/locales/sr-CS.yml +1 -2
- data/config/locales/sv.yml +22 -3
- data/config/locales/tr-TR.yml +1 -3
- data/config/locales/uk.yml +1 -2
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/zh-CN.yml +1 -3
- data/lib/decidim/admin/engine.rb +0 -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 +26 -0
- data/lib/decidim/admin/version.rb +1 -1
- metadata +21 -15
- 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a5ed15c6f0a16e84e95cb02c129c2b52cb40bccf9c8b90b85c8bc1c7012e1412
|
|
4
|
+
data.tar.gz: 46b07fc0bf82a571a725d3f3e8eca721bac6fd37faa09876a17cbaa5a565d36b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61558f5b7c81beada95e0fe404e20dae4365cd93b0119ab20d2a238cd3bb2b6509b54a5579787971793f67f22b43679aff0502a7569d037665955e26571bcf41
|
|
7
|
+
data.tar.gz: 90e6c74f71c60251c4ebe7d7d46894db2681558f68843bb4bd5d9001a2fd32cebf63ee705951d535670e6634c5d62820d1794c2c87c053abb73cf22b9a5e0d61
|
|
@@ -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
|
|
@@ -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.
|
|
@@ -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
|
|
@@ -4,7 +4,7 @@ module Decidim
|
|
|
4
4
|
module Admin
|
|
5
5
|
# A command that reorders a collection of content blocks. It also creates
|
|
6
6
|
# the ones that might be missing.
|
|
7
|
-
class ReorderContentBlocks <
|
|
7
|
+
class ReorderContentBlocks < Decidim::Command
|
|
8
8
|
# Public: Initializes the command.
|
|
9
9
|
#
|
|
10
10
|
# organization - the Organization where the content blocks reside
|