闭社主体 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.

27 lines
582 B

  1. # frozen_string_literal: true
  2. class UnblockDomainService < BaseService
  3. attr_accessor :domain_block
  4. def call(domain_block, retroactive)
  5. @domain_block = domain_block
  6. process_retroactive_updates if retroactive
  7. domain_block.destroy
  8. end
  9. def process_retroactive_updates
  10. blocked_accounts.in_batches.update_all(update_options)
  11. end
  12. def blocked_accounts
  13. Account.where(domain: domain_block.domain)
  14. end
  15. def update_options
  16. { domain_block_impact => false }
  17. end
  18. def domain_block_impact
  19. domain_block.silence? ? :silenced : :suspended
  20. end
  21. end