1
0
Fork 1
mirror of https://github.com/mastodon/mastodon.git synced 2024-12-29 20:13:15 +00:00
mastodon/app/services/unblock_domain_service.rb

19 lines
601 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class UnblockDomainService < BaseService
attr_accessor :domain_block
def call(domain_block)
@domain_block = domain_block
process_retroactive_updates
domain_block.destroy
end
def process_retroactive_updates
scope = Account.by_domain_and_subdomains(domain_block.domain)
scope.where(silenced_at: domain_block.created_at).in_batches.update_all(silenced_at: nil) unless domain_block.noop?
scope.where(suspended_at: domain_block.created_at).in_batches.update_all(suspended_at: nil, suspension_origin: nil) if domain_block.suspend?
end
end