From 192e9d16eb60255770d468df4f9fa3297e5549ef Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 14 Oct 2024 10:18:25 +0200 Subject: [PATCH] Fix follow recommendation suppressions not applying immediately (#32392) --- app/models/follow_recommendation.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/follow_recommendation.rb b/app/models/follow_recommendation.rb index 7ac9e6dfb9..0435437a81 100644 --- a/app/models/follow_recommendation.rb +++ b/app/models/follow_recommendation.rb @@ -18,5 +18,6 @@ class FollowRecommendation < ApplicationRecord belongs_to :account_summary, foreign_key: :account_id, inverse_of: false belongs_to :account - scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) } + scope :unsupressed, -> { where.not(FollowRecommendationSuppression.where(FollowRecommendationSuppression.arel_table[:account_id].eq(arel_table[:account_id])).select(1).arel.exists) } + scope :localized, ->(locale) { unsupressed.joins(:account_summary).merge(AccountSummary.localized(locale)) } end