Fix deletion of unconfirmed users with Webauthn set (#33186)

This commit is contained in:
Claire 2025-01-15 12:50:50 +01:00
parent 4a9abd93ab
commit e6b97fc940
2 changed files with 20 additions and 2 deletions

View file

@ -16,6 +16,7 @@ class Scheduler::UserCleanupScheduler
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
WebauthnCredential.where(user_id: batch.map(&:id)).delete_all
Account.where(id: batch.map(&:account_id)).delete_all
User.where(id: batch.map(&:id)).delete_all
end