about summary refs log tree commit diff
path: root/app/workers/unfollow_follow_worker.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-01-10 18:46:17 +0100
committerThibaut Girka <thib@sitedethib.com>2019-01-10 18:46:17 +0100
commitfb0c906c717f2b21bb63610742a357850142b522 (patch)
tree696e649bcf15c2a7926e2d6d5f9e08f90aaef058 /app/workers/unfollow_follow_worker.rb
parentd1da0a1086fa25f22739277fbf32ba1b3745317d (diff)
Revert "Revert "Add handler for Move activity (#9629)""
This reverts commit bb96a7463758687f8187ae4483becd346c2482b3.
Diffstat (limited to 'app/workers/unfollow_follow_worker.rb')
-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