logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

unblock_domain_service.rb (608B)


  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) unless domain_block.noop?
  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