From d29b1cca2e1dd9f38a12086ca8010fafbb0cac33 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 20 Dec 2023 15:35:59 +0100 Subject: [PATCH] Fix `friends_of_friends` sometimes suggesting already-followed accounts (#28433) --- app/models/account_suggestions/friends_of_friends_source.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/account_suggestions/friends_of_friends_source.rb b/app/models/account_suggestions/friends_of_friends_source.rb index 77d4f635aa..28d0ab99b3 100644 --- a/app/models/account_suggestions/friends_of_friends_source.rb +++ b/app/models/account_suggestions/friends_of_friends_source.rb @@ -16,7 +16,7 @@ class AccountSuggestions::FriendsOfFriendsSource < AccountSuggestions::Source JOIN account_stats ON account_stats.account_id = accounts.id LEFT OUTER JOIN follow_recommendation_mutes ON follow_recommendation_mutes.target_account_id = accounts.id AND follow_recommendation_mutes.account_id = :id WHERE follows.account_id IN (SELECT * FROM first_degree) - AND follows.target_account_id NOT IN (SELECT * FROM first_degree) + AND NOT EXISTS (SELECT 1 FROM follows f WHERE f.target_account_id = follows.target_account_id AND f.account_id = :id) AND follows.target_account_id <> :id AND accounts.discoverable AND accounts.suspended_at IS NULL