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