about summary refs log tree commit diff
path: root/app/services/purge_domain_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/purge_domain_service.rb')
-rw-r--r--app/services/purge_domain_service.rb11
1 files changed, 11 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..9df81f13e
--- /dev/null
+++ b/app/services/purge_domain_service.rb
@@ -0,0 +1,11 @@
+# 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
+    CustomEmoji.remote.where(domain: domain).reorder(nil).find_each(&:destroy)
+    Instance.refresh
+  end
+end