闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
566 B

  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