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.

13 lines
331 B

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