mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-16 03:35:16 +00:00
b8ba719f73
* Add spec for unblock domain service * Refactor UnblockDomainService
28 lines
582 B
Ruby
28 lines
582 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UnblockDomainService < BaseService
|
|
attr_accessor :domain_block
|
|
|
|
def call(domain_block, retroactive)
|
|
@domain_block = domain_block
|
|
process_retroactive_updates if retroactive
|
|
domain_block.destroy
|
|
end
|
|
|
|
def process_retroactive_updates
|
|
blocked_accounts.in_batches.update_all(update_options)
|
|
end
|
|
|
|
def blocked_accounts
|
|
Account.where(domain: domain_block.domain)
|
|
end
|
|
|
|
def update_options
|
|
{ domain_block_impact => false }
|
|
end
|
|
|
|
def domain_block_impact
|
|
domain_block.silence? ? :silenced : :suspended
|
|
end
|
|
end
|