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

14 lines
455 B

  1. # frozen_string_literal: true
  2. class BlockDomainService < BaseService
  3. def call(domain_block)
  4. if domain_block.silence?
  5. Account.where(domain: domain_block.domain).update_all(silenced: true)
  6. else
  7. Account.where(domain: domain_block.domain).find_each do |account|
  8. account.subscription(api_subscription_url(account.id)).unsubscribe if account.subscribed?
  9. SuspendAccountService.new.call(account)
  10. end
  11. end
  12. end
  13. end