about summary refs log tree commit diff
path: root/app/workers/scheduler/user_cleanup_scheduler.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-11-06 18:49:46 +0100
committerGitHub <noreply@github.com>2022-11-06 18:49:46 +0100
commit54101563bbadbfafd9291a867d7fbea6df3a8b7b (patch)
treefcf9a125f6ebc3ad4182fa0edcbd7101b33aebb0 /app/workers/scheduler/user_cleanup_scheduler.rb
parent2f8fb49d1314db931385089bc9004a48700161ad (diff)
parent21d6bc16893a9dd24c5ef54cf2f554846c8eca5b (diff)
Merge pull request #1892 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/workers/scheduler/user_cleanup_scheduler.rb')
-rw-r--r--app/workers/scheduler/user_cleanup_scheduler.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/workers/scheduler/user_cleanup_scheduler.rb b/app/workers/scheduler/user_cleanup_scheduler.rb
index d1f00c47f..7a6995a1f 100644
--- a/app/workers/scheduler/user_cleanup_scheduler.rb
+++ b/app/workers/scheduler/user_cleanup_scheduler.rb
@@ -15,6 +15,8 @@ class Scheduler::UserCleanupScheduler
 
   def clean_unconfirmed_accounts!
     User.where('confirmed_at is NULL AND confirmation_sent_at <= ?', 2.days.ago).reorder(nil).find_in_batches do |batch|
+      # We have to do it separately because of missing database constraints
+      AccountModerationNote.where(account_id: batch.map(&:account_id)).delete_all
       Account.where(id: batch.map(&:account_id)).delete_all
       User.where(id: batch.map(&:id)).delete_all
     end