1
0
mirror of https://github.com/whippyshou/mastodon synced 2024-12-01 08:18:48 +09:00

Fix UserCleanupScheduler crash when an unconfirmed account has a moderation note (#19629)

Fixes #19109
This commit is contained in:
Claire 2022-11-01 12:59:23 +01:00 committed by GitHub
parent fea142fb9a
commit 03d9618595
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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