From c4af668e5ccf0ba26b3abc83b9bc36c3aa57a549 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 30 Jan 2024 18:24:40 +0100 Subject: [PATCH] Fix follow recommendations for less used languages (#29017) --- app/models/account_summary.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/account_summary.rb b/app/models/account_summary.rb index 2a21d09a8b..f052816361 100644 --- a/app/models/account_summary.rb +++ b/app/models/account_summary.rb @@ -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