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

@ -23,6 +23,7 @@ class AccountSearchService < BaseService
query: {
bool: {
must: must_clauses,
must_not: must_not_clauses,
},
},
@ -49,6 +50,10 @@ class AccountSearchService < BaseService
end
end
def must_not_clauses
[]
end
def should_clauses
if @account && !@options[:following]
[boost_following_query]

View file

@ -20,7 +20,7 @@ class FavouriteService < BaseService
Trends.statuses.register(status)
create_notification(favourite)
bump_potential_friendship(account, status)
increment_statistics
favourite
end
@ -37,11 +37,8 @@ class FavouriteService < BaseService
end
end
def bump_potential_friendship(account, status)
def increment_statistics
ActivityTracker.increment('activity:interactions')
return if account.following?(status.account_id)
PotentialFriendshipTracker.record(account.id, status.account_id, :favourite)
end
def build_json(favourite)

View file

@ -178,9 +178,6 @@ class PostStatusService < BaseService
return if !@status.reply? || @account.id == @status.in_reply_to_account_id
ActivityTracker.increment('activity:interactions')
return if @account.following?(@status.in_reply_to_account_id)
PotentialFriendshipTracker.record(@account.id, @status.in_reply_to_account_id, :reply)
end
def status_attributes

View file

@ -33,7 +33,7 @@ class ReblogService < BaseService
ActivityPub::DistributionWorker.perform_async(reblog.id)
create_notification(reblog)
bump_potential_friendship(account, reblog)
increment_statistics
reblog
end
@ -50,12 +50,8 @@ class ReblogService < BaseService
end
end
def bump_potential_friendship(account, reblog)
def increment_statistics
ActivityTracker.increment('activity:interactions')
return if account.following?(reblog.reblog.account_id)
PotentialFriendshipTracker.record(account.id, reblog.reblog.account_id, :reblog)
end
def build_json(reblog)