From e85287284611f7de431d9c51353125c265ebfe3f Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Wed, 28 Feb 2018 06:55:06 +0100
Subject: [PATCH] Fix #5708: Reject->Follow will remove the follow if it exists
 (#6571)

---
 app/lib/activitypub/activity/reject.rb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/app/lib/activitypub/activity/reject.rb b/app/lib/activitypub/activity/reject.rb
index d815feeb6c..28d472883f 100644
--- a/app/lib/activitypub/activity/reject.rb
+++ b/app/lib/activitypub/activity/reject.rb
@@ -17,6 +17,8 @@ class ActivityPub::Activity::Reject < ActivityPub::Activity
 
     follow_request = FollowRequest.find_by(account: target_account, target_account: @account)
     follow_request&.reject!
+
+    UnfollowService.new.call(target_account, @account) if target_account.following?(@account)
   end
 
   def target_uri
-- 
GitLab