about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-08-17 16:24:56 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-08-17 16:24:56 +0200
commit59f7f4c923494bb8dd6f2881a1610c7b51240d9c (patch)
tree9f01be5d65a9cdecfb92a7276e462bd6ab6db8e2 /app/lib
parent1ee675d68bfd2034183a03408a2377c338dfac41 (diff)
Implement Undo { Accept { Follow } } (fixes #8234) (#8245)
* Add Follow#revoke_request!

* Implement Undo { Accept { Follow } } (fixes #8234)
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/activitypub/activity/undo.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/lib/activitypub/activity/undo.rb b/app/lib/activitypub/activity/undo.rb
index cbed417c4..64c2be7d9 100644
--- a/app/lib/activitypub/activity/undo.rb
+++ b/app/lib/activitypub/activity/undo.rb
@@ -5,6 +5,8 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
     case @object['type']
     when 'Announce'
       undo_announce
+    when 'Accept'
+      undo_accept
     when 'Follow'
       undo_follow
     when 'Like'
@@ -27,6 +29,10 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
     end
   end
 
+  def undo_accept
+    ::Follow.find_by(target_account: @account, uri: target_uri)&.revoke_request!
+  end
+
   def undo_follow
     target_account = account_from_uri(target_uri)