From a43c1d3f56c128c992f34b8e2b968de14e02ac48 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Tue, 1 Sep 2020 19:39:52 -0500 Subject: from monsterfork: [Privacy] Purge and re-download remote accounts if their actor key suddenly changes --- app/workers/reset_account_worker.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 app/workers/reset_account_worker.rb (limited to 'app/workers/reset_account_worker.rb') diff --git a/app/workers/reset_account_worker.rb b/app/workers/reset_account_worker.rb new file mode 100644 index 000000000..f63d8682a --- /dev/null +++ b/app/workers/reset_account_worker.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class ResetAccountWorker + include Sidekiq::Worker + + def perform(account_id) + account = Account.find(account_id) + return if account.local? + + account_uri = account.uri + SuspendAccountService.new.call(account) + ResolveAccountService.new.call(account_uri) + rescue ActiveRecord::RecordNotFound + true + end +end -- cgit