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.

18 lines
411 B

  1. # frozen_string_literal: true
  2. class UnallowDomainService < BaseService
  3. include DomainControlHelper
  4. def call(domain_allow)
  5. suspend_accounts!(domain_allow.domain) if whitelist_mode?
  6. domain_allow.destroy
  7. end
  8. private
  9. def suspend_accounts!(domain)
  10. Account.where(domain: domain).in_batches.update_all(suspended_at: Time.now.utc)
  11. AfterUnallowDomainWorker.perform_async(domain)
  12. end
  13. end