Safefy: Updated Admin::AccountDeletionWorker to match AccountDeletionWorker (#37577)
This commit is contained in:
parent
3806d15d99
commit
1809048105
@ -6,7 +6,10 @@ class Admin::AccountDeletionWorker
|
|||||||
sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i
|
sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i
|
||||||
|
|
||||||
def perform(account_id)
|
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
|
rescue ActiveRecord::RecordNotFound
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -6,7 +6,7 @@ RSpec.describe Admin::AccountDeletionWorker do
|
|||||||
let(:worker) { described_class.new }
|
let(:worker) { described_class.new }
|
||||||
|
|
||||||
describe 'perform' do
|
describe 'perform' do
|
||||||
let(:account) { Fabricate(:account) }
|
let(:account) { Fabricate(:account, suspended: true) }
|
||||||
let(:service) { instance_double(DeleteAccountService, call: true) }
|
let(:service) { instance_double(DeleteAccountService, call: true) }
|
||||||
|
|
||||||
it 'calls delete account service' do
|
it 'calls delete account service' do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user