Safefy: Updated Admin::AccountDeletionWorker to match AccountDeletionWorker (#37577)

This commit is contained in:
Shlee
2026-01-23 02:31:44 +10:30
committed by GitHub
parent 3806d15d99
commit 1809048105
2 changed files with 5 additions and 2 deletions

View File

@@ -6,7 +6,10 @@ class Admin::AccountDeletionWorker
sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i
def perform(account_id)
DeleteAccountService.new.call(Account.find(account_id), reserve_username: true, reserve_email: true)
delete_account = Account.find(account_id)
return unless delete_account.unavailable?
DeleteAccountService.new.call(delete_account, reserve_username: true, reserve_email: true)
rescue ActiveRecord::RecordNotFound
true
end

View File

@@ -6,7 +6,7 @@ RSpec.describe Admin::AccountDeletionWorker do
let(:worker) { described_class.new }
describe 'perform' do
let(:account) { Fabricate(:account) }
let(:account) { Fabricate(:account, suspended: true) }
let(:service) { instance_double(DeleteAccountService, call: true) }
it 'calls delete account service' do