From 2e46250f929169d9994db2dc8666c772dbdef570 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sun, 1 Mar 2020 14:22:56 -0600 Subject: 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 --- app/lib/activitypub/activity/follow.rb | 10 +++++----- 1 file 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? -- cgit