catstodon/app/models/account_suggestions/global_source.rb
Eugen Rochko b5ac61b2c5
Change algorithm of follow recommendations (#28314)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2023-12-19 10:59:43 +00:00

13 lines
381 B
Ruby

# frozen_string_literal: true
class AccountSuggestions::GlobalSource < AccountSuggestions::Source
def get(account, limit: 10)
FollowRecommendation.localized(content_locale).joins(:account).merge(base_account_scope(account)).order(rank: :desc).limit(limit).pluck(:account_id, :reason)
end
private
def content_locale
I18n.locale.to_s.split(/[_-]/).first
end
end