From a41ffa27e7e3e031b48cb67f2fcb209e21474738 Mon Sep 17 00:00:00 2001 From: ayuki_j <19406594+ayuki-joto@users.noreply.github.com> Date: Mon, 8 Apr 2024 21:05:08 +0900 Subject: [PATCH 1/3] fix: delete.rake --- .../destroy_all_participatory_processes.rb | 2 ++ lib/tasks/delete.rake | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/commands/decidim/participatory_processes/destroy_all_participatory_processes.rb b/app/commands/decidim/participatory_processes/destroy_all_participatory_processes.rb index 4fd9100ac..6e4d22079 100644 --- a/app/commands/decidim/participatory_processes/destroy_all_participatory_processes.rb +++ b/app/commands/decidim/participatory_processes/destroy_all_participatory_processes.rb @@ -25,6 +25,8 @@ def call puts "destroy participatory_process_group id: #{participatory_process_group.id}" participatory_process_group.destroy! end + Decidim::ParticipatoryProcessType.where(organization: organization).destroy_all + Decidim::NavigationMaps::Blueprint.where(organization: organization).destroy_all Decidim::ContentBlock.where(organization: organization).destroy_all Decidim::Scope.where(organization: organization).destroy_all Decidim::ScopeType.where(organization: organization).destroy_all diff --git a/lib/tasks/delete.rake b/lib/tasks/delete.rake index 7aa336ad6..b57a2f30c 100644 --- a/lib/tasks/delete.rake +++ b/lib/tasks/delete.rake @@ -225,7 +225,7 @@ namespace :delete do organization = decidim_find_organization return unless organization - form = Struct.new(valid?: true, delete_reason: "Testing") + form = OpenStruct.new(valid?: true, delete_reason: "Testing") Decidim::User.transaction do Decidim::User.where(organization: organization).find_each(batch_size: 100) do |user| Decidim::Gamifications::DestroyAllBadges.call(organization, user) From fe24dabd91ad8c28f987f65e8ad0e1ca46750d81 Mon Sep 17 00:00:00 2001 From: ayuki_j <19406594+ayuki-joto@users.noreply.github.com> Date: Mon, 8 Apr 2024 21:35:47 +0900 Subject: [PATCH 2/3] fix: rubocop --- .rubocop_rails.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.rubocop_rails.yml b/.rubocop_rails.yml index 03ed9bb13..d3d445cb3 100644 --- a/.rubocop_rails.yml +++ b/.rubocop_rails.yml @@ -97,3 +97,7 @@ Rails/I18nLocaleAssignment: Lint/EmptyBlock: Enabled: false + +Style/OpenStructUse: + Exclude: + - lib/tasks/delete.rake From d5ad85f979cb292334b0d941ca3c56340fcbf829 Mon Sep 17 00:00:00 2001 From: ayuki_j <19406594+ayuki-joto@users.noreply.github.com> Date: Mon, 8 Apr 2024 22:11:03 +0900 Subject: [PATCH 3/3] fix: add Decidim::Verifications::CsvDatum --- app/commands/decidim/organizations/destroy_organization.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/commands/decidim/organizations/destroy_organization.rb b/app/commands/decidim/organizations/destroy_organization.rb index 7c5a981bd..b48f7b309 100644 --- a/app/commands/decidim/organizations/destroy_organization.rb +++ b/app/commands/decidim/organizations/destroy_organization.rb @@ -24,6 +24,8 @@ def call end end + Decidim::Verifications::CsvDatum.where(organization: organization).delete_all + Decidim::Verifications::Conflict.find_each do |conflict| if conflict.current_user.organization == organization || conflict.managed_user.organization == organization puts "destroy verifications_conflict id: #{conflict.id}"