Skip to content

Commit

Permalink
Merge pull request #598 from codeforjapan/fix/delete.rake
Browse files Browse the repository at this point in the history
  • Loading branch information
ayuki-joto authored Apr 8, 2024
2 parents 5af6856 + d5ad85f commit 52915ed
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .rubocop_rails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,7 @@ Rails/I18nLocaleAssignment:

Lint/EmptyBlock:
Enabled: false

Style/OpenStructUse:
Exclude:
- lib/tasks/delete.rake
2 changes: 2 additions & 0 deletions app/commands/decidim/organizations/destroy_organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/delete.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 52915ed

Please sign in to comment.