Fix `friends_of_friends` sometimes suggesting already-followed accounts (#28433)

pull/28451/head
Claire 2023-12-20 15:35:59 +01:00 committed by GitHub
parent ac04e62a0e
commit d29b1cca2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ class AccountSuggestions::FriendsOfFriendsSource < AccountSuggestions::Source
JOIN account_stats ON account_stats.account_id = accounts.id 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 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) 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 follows.target_account_id <> :id
AND accounts.discoverable AND accounts.discoverable
AND accounts.suspended_at IS NULL AND accounts.suspended_at IS NULL