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

15 lines
354 B

  1. # frozen_string_literal: true
  2. class BlockDomainService < BaseService
  3. def call(domain)
  4. DomainBlock.find_or_create_by!(domain: domain)
  5. Account.where(domain: domain).find_each do |account|
  6. if account.subscribed?
  7. account.subscription(api_subscription_url(account.id)).unsubscribe
  8. end
  9. account.destroy!
  10. end
  11. end
  12. end