2021-04-24 15:01:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class AccountSuggestions::GlobalSource < AccountSuggestions::Source
|
2024-02-20 09:21:49 +00:00
|
|
|
def get(account, limit: DEFAULT_LIMIT)
|
2023-12-19 10:59:43 +00:00
|
|
|
FollowRecommendation.localized(content_locale).joins(:account).merge(base_account_scope(account)).order(rank: :desc).limit(limit).pluck(:account_id, :reason)
|
2021-04-24 15:01:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2023-12-19 10:59:43 +00:00
|
|
|
def content_locale
|
|
|
|
I18n.locale.to_s.split(/[_-]/).first
|
2021-04-24 15:01:43 +00:00
|
|
|
end
|
|
|
|
end
|