* Fix `UserCleanupScheduler` crash when an unconfirmed account has a moderation note * Add tests
This commit is contained in:
parent
a2bfb16cb8
commit
6cbc589990
2 changed files with 41 additions and 0 deletions
|
|
@ -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(target_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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue