1
0

unblock_domain_service.rb 601 B

123456789101112131415161718
  1. # frozen_string_literal: true
  2. class UnblockDomainService < BaseService
  3. attr_accessor :domain_block
  4. def call(domain_block)
  5. @domain_block = domain_block
  6. process_retroactive_updates
  7. domain_block.destroy
  8. end
  9. def process_retroactive_updates
  10. scope = Account.by_domain_and_subdomains(domain_block.domain)
  11. scope.where(silenced_at: domain_block.created_at).in_batches.update_all(silenced_at: nil) unless domain_block.noop?
  12. scope.where(suspended_at: domain_block.created_at).in_batches.update_all(suspended_at: nil, suspension_origin: nil) if domain_block.suspend?
  13. end
  14. end