about summary refs log tree commit diff
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-03-01 14:22:56 -0600
committermultiple creatures <dev@multiple-creature.party>2020-03-01 14:22:56 -0600
commit2e46250f929169d9994db2dc8666c772dbdef570 (patch)
treeda420452832832726d47884234e7a13f98ef168c
parent014b6c95919bba62aa48aa54e093a9b0838278a9 (diff)
fix bug in which someone enabling `reject unknown follows` after accepting a follow can cause it to be rejected if the remote server sends duplicate requests
-rw-r--r--app/lib/activitypub/activity/follow.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/lib/activitypub/activity/follow.rb b/app/lib/activitypub/activity/follow.rb
index 94de89b86..d28c9defc 100644
--- a/app/lib/activitypub/activity/follow.rb
+++ b/app/lib/activitypub/activity/follow.rb
@@ -13,17 +13,17 @@ class ActivityPub::Activity::Follow < ActivityPub::Activity
       return
     end
 
-    if !target_account.user.allow_unknown_follows? && !@account.ever_interacted_with?(target_account)
-      reject_follow_request!(target_account)
-      return
-    end
-
     # Fast-forward repeat follow requests
     if @account.following?(target_account)
       AuthorizeFollowService.new.call(@account, target_account, skip_follow_request: true, follow_request_uri: @json['id'])
       return
     end
 
+    if !target_account.user.allow_unknown_follows? && !@account.ever_interacted_with?(target_account)
+      reject_follow_request!(target_account)
+      return
+    end
+
     follow_request = FollowRequest.create!(account: @account, target_account: target_account, uri: @json['id'])
 
     if target_account.locked?