about summary refs log tree commit diff
path: root/app/workers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-12-29 02:24:36 +0100
committerGitHub <noreply@github.com>2018-12-29 02:24:36 +0100
commit0f938ff29c2e9bf92e3eb9c23be8d4ba3a1b97f7 (patch)
treea7f9cb2672014b95f77f1a9fe802009f889574e0 /app/workers
parent9b475a4838abc6143e26776816280e16abfc6193 (diff)
Add handler for Move activity (#9629)
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/unfollow_follow_worker.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/workers/unfollow_follow_worker.rb b/app/workers/unfollow_follow_worker.rb
new file mode 100644
index 000000000..a2133bb8c
--- /dev/null
+++ b/app/workers/unfollow_follow_worker.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class UnfollowFollowWorker
+  include Sidekiq::Worker
+
+  sidekiq_options queue: 'pull'
+
+  def perform(follower_account_id, old_target_account_id, new_target_account_id)
+    follower_account   = Account.find(follower_account_id)
+    old_target_account = Account.find(old_target_account_id)
+    new_target_account = Account.find(new_target_account_id)
+
+    UnfollowService.new.call(follower_account, old_target_account)
+    FollowService.new.call(follower_account, new_target_account)
+  rescue ActiveRecord::RecordNotFound
+    true
+  end
+end