Skip to content

Commit

Permalink
Fix removing a DomainAllow rule wiping known accounts in open federat…
Browse files Browse the repository at this point in the history
…ion mode (mastodon#14298)

Fixes mastodon#14296
  • Loading branch information
ClearlyClaire authored and Mage committed Jan 14, 2022
1 parent 35ba356 commit f2c6ddf
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/services/unallow_domain_service.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# frozen_string_literal: true

class UnallowDomainService < BaseService
include DomainControlHelper

def call(domain_allow)
Account.where(domain: domain_allow.domain).find_each do |account|
SuspendAccountService.new.call(account, reserve_username: false)
end
suspend_accounts!(domain_allow.domain) if whitelist_mode?

domain_allow.destroy
end

private

def suspend_accounts!(domain)
Account.where(domain: domain).find_each do |account|
SuspendAccountService.new.call(account, reserve_username: false)
end
end
end

0 comments on commit f2c6ddf

Please sign in to comment.