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