2021-04-25 01:01:43 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class AccountSuggestions::GlobalSource < AccountSuggestions::Source
|
2023-12-19 21:59:43 +11:00
|
|
|
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)
|
2021-04-25 01:01:43 +10:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2023-12-19 21:59:43 +11:00
|
|
|
def content_locale
|
|
|
|
I18n.locale.to_s.split(/[_-]/).first
|
2021-04-25 01:01:43 +10:00
|
|
|
end
|
|
|
|
end
|