From d3b67461735f9a1c38a7eee655a8131bcf6a0cbf Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Sat, 2 Sep 2017 20:44:41 +0200
Subject: Make "unfollow" undo pending outgoing follow request too (#4781)

* Make "unfollow" undo pending outgoing follow request too

* Add cancel button to web UI when awaiting follow request approval

* Make the hourglass button do the cancelling
---
 app/lib/activitypub/activity/undo.rb | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'app/lib')

diff --git a/app/lib/activitypub/activity/undo.rb b/app/lib/activitypub/activity/undo.rb
index 097b1dba4..4b0905de2 100644
--- a/app/lib/activitypub/activity/undo.rb
+++ b/app/lib/activitypub/activity/undo.rb
@@ -33,6 +33,8 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
 
     if @account.following?(target_account)
       @account.unfollow!(target_account)
+    elsif @account.requested?(target_account)
+      FollowRequest.find_by(account: @account, target_account: target_account)&.destroy
     else
       delete_later!(object_uri)
     end
-- 
cgit