Fix follow recommendations for less used languages (#29017)

main-rebase-security-fix
Eugen Rochko 2024-01-30 18:24:40 +01:00 committed by GitHub
parent 0c0d077276
commit c4af668e5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class AccountSummary < ApplicationRecord
has_many :follow_recommendation_suppressions, primary_key: :account_id, foreign_key: :account_id, inverse_of: false
scope :safe, -> { where(sensitive: false) }
scope :localized, ->(locale) { where(language: locale) }
scope :localized, ->(locale) { order(Arel::Nodes::Case.new.when(arel_table[:language].eq(locale)).then(1).else(0).desc) }
scope :filtered, -> { where.missing(:follow_recommendation_suppressions) }
def self.refresh