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 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}" 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)