global_source.rb 392 B

12345678910111213
  1. # frozen_string_literal: true
  2. class AccountSuggestions::GlobalSource < AccountSuggestions::Source
  3. def get(account, limit: DEFAULT_LIMIT)
  4. FollowRecommendation.localized(content_locale).joins(:account).merge(base_account_scope(account)).order(rank: :desc).limit(limit).pluck(:account_id, :reason)
  5. end
  6. private
  7. def content_locale
  8. I18n.locale.to_s.split(/[_-]/).first
  9. end
  10. end