Change algorithm of follow recommendations (#28314)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Eugen Rochko 2023-12-19 11:59:43 +01:00 committed by GitHub
parent b7bdcd4f39
commit b5ac61b2c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 297 additions and 292 deletions

View file

@ -116,8 +116,6 @@ module Account::Interactions
rel.save! if rel.changed?
remove_potential_friendship(other_account)
rel
end
@ -131,13 +129,10 @@ module Account::Interactions
rel.save! if rel.changed?
remove_potential_friendship(other_account)
rel
end
def block!(other_account, uri: nil)
remove_potential_friendship(other_account)
block_relationships.create_with(uri: uri)
.find_or_create_by!(target_account: other_account)
end
@ -148,8 +143,6 @@ module Account::Interactions
mute.expires_in = duration.zero? ? nil : duration
mute.save!
remove_potential_friendship(other_account)
# When toggling a mute between hiding and allowing notifications, the mute will already exist, so the find_or_create_by! call will return the existing Mute without updating the hide_notifications attribute. Therefore, we check that hide_notifications? is what we want and set it if it isn't.
mute.update!(hide_notifications: notifications) if mute.hide_notifications? != notifications
@ -307,10 +300,4 @@ module Account::Interactions
domain_blocking_by_domain: Account.domain_blocking_map_by_domain(domains, id),
})
end
private
def remove_potential_friendship(other_account)
PotentialFriendshipTracker.remove(id, other_account.id)
end
end