about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-12-17 23:01:21 +0100
committerGitHub <noreply@github.com>2021-12-17 23:01:21 +0100
commit7f803c41e2ca54b7b787b1f111f91357136c0e68 (patch)
tree4583b08c706ac25f05be5dc2908d52a55a71c81a /app/services
parent0c17fd91091fd2f230224d5fce218688d480502c (diff)
Add ability to purge undeliverable domains from admin interface (#16686)
* Add ability to purge undeliverable domains from admin interface

* Add tests
Diffstat (limited to 'app/services')
-rw-r--r--app/services/purge_domain_service.rb10
1 files changed, 10 insertions, 0 deletions
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