account_deletion_worker.rb 566 B

123456789101112131415
  1. # frozen_string_literal: true
  2. class AccountDeletionWorker
  3. include Sidekiq::Worker
  4. sidekiq_options queue: 'pull', lock: :until_executed
  5. def perform(account_id, options = {})
  6. reserve_username = options.with_indifferent_access.fetch(:reserve_username, true)
  7. skip_activitypub = options.with_indifferent_access.fetch(:skip_activitypub, false)
  8. DeleteAccountService.new.call(Account.find(account_id), reserve_username: reserve_username, skip_activitypub: skip_activitypub, reserve_email: false)
  9. rescue ActiveRecord::RecordNotFound
  10. true
  11. end
  12. end