From 7f803c41e2ca54b7b787b1f111f91357136c0e68 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 17 Dec 2021 23:01:21 +0100 Subject: Add ability to purge undeliverable domains from admin interface (#16686) * Add ability to purge undeliverable domains from admin interface * Add tests --- app/services/purge_domain_service.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/services/purge_domain_service.rb (limited to 'app/services/purge_domain_service.rb') diff --git a/app/services/purge_domain_service.rb b/app/services/purge_domain_service.rb new file mode 100644 index 000000000..e10a8f0c8 --- /dev/null +++ b/app/services/purge_domain_service.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class PurgeDomainService < BaseService + def call(domain) + Account.remote.where(domain: domain).reorder(nil).find_each do |account| + DeleteAccountService.new.call(account, reserve_username: false, skip_side_effects: true) + end + Instance.refresh + end +end -- cgit