From e89204aa60110adc82c0188e9854545946c1ef0d Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 22 Nov 2024 09:30:57 +0100 Subject: [PATCH] Fix pushing hashtag-followed posts to feeds of inactive users (#33018) --- app/models/tag_follow.rb | 2 ++ app/services/fan_out_on_write_service.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/tag_follow.rb b/app/models/tag_follow.rb index abe36cd171..528616c450 100644 --- a/app/models/tag_follow.rb +++ b/app/models/tag_follow.rb @@ -21,4 +21,6 @@ class TagFollow < ApplicationRecord accepts_nested_attributes_for :tag rate_limit by: :account, family: :follows + + scope :for_local_distribution, -> { joins(account: :user).merge(User.signed_in_recently) } end diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 50b414bc52..3c084bc857 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -103,7 +103,7 @@ class FanOutOnWriteService < BaseService end def deliver_to_hashtag_followers! - TagFollow.where(tag_id: @status.tags.map(&:id)).select(:id, :account_id).reorder(nil).find_in_batches do |follows| + TagFollow.for_local_distribution.where(tag_id: @status.tags.map(&:id)).select(:id, :account_id).reorder(nil).find_in_batches do |follows| FeedInsertWorker.push_bulk(follows) do |follow| [@status.id, follow.account_id, 'tags', { 'update' => update? }] end