diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-11-01 12:59:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-01 12:59:23 +0100 |
commit | 03d9618595bd2433a319c0bfc0f5bbb14653d0d6 (patch) | |
tree | 96bacde3bc56f67e648dbdc131806ee567832f7d /app/workers/scheduler | |
parent | fea142fb9a0a6f7a4b92e608d638a26598f0a4e1 (diff) |
Fix UserCleanupScheduler crash when an unconfirmed account has a moderation note (#19629)
Fixes #19109
Diffstat (limited to 'app/workers/scheduler')
-rw-r--r-- | app/workers/scheduler/user_cleanup_scheduler.rb | 2 |
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 |