Change algorithm of follow recommendations (#28314)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
b7bdcd4f39
commit
b5ac61b2c5
35 changed files with 297 additions and 292 deletions
|
@ -64,6 +64,7 @@ module Account::Associations
|
|||
has_one :deletion_request, class_name: 'AccountDeletionRequest', inverse_of: :account, dependent: :destroy
|
||||
|
||||
# Follow recommendations
|
||||
has_one :follow_recommendation, inverse_of: :account, dependent: nil
|
||||
has_one :follow_recommendation_suppression, inverse_of: :account, dependent: :destroy
|
||||
|
||||
# Account statuses cleanup policy
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -116,6 +116,7 @@ module Account::Search
|
|||
[].tap do |properties|
|
||||
properties << 'bot' if bot?
|
||||
properties << 'verified' if fields.any?(&:verified?)
|
||||
properties << 'discoverable' if discoverable?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue