unallow_domain_service.rb 420 B

123456789101112131415161718
  1. # frozen_string_literal: true
  2. class UnallowDomainService < BaseService
  3. include DomainControlHelper
  4. def call(domain_allow)
  5. suspend_accounts!(domain_allow.domain) if limited_federation_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