Browse Source

Fix pushing hashtag-followed posts to feeds of inactive users (#33018)

pull/1368/head
Eugen Rochko 1 year ago committed by Claire
parent
commit
e26bb6f827
  1. 2
      app/models/tag_follow.rb
  2. 2
      app/services/fan_out_on_write_service.rb

2
app/models/tag_follow.rb

@ -21,4 +21,6 @@ class TagFollow < ApplicationRecord
accepts_nested_attributes_for :tag accepts_nested_attributes_for :tag
rate_limit by: :account, family: :follows rate_limit by: :account, family: :follows
scope :for_local_distribution, -> { joins(account: :user).merge(User.signed_in_recently) }
end end

2
app/services/fan_out_on_write_service.rb

@ -94,7 +94,7 @@ class FanOutOnWriteService < BaseService
end end
def deliver_to_hashtag_followers! 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| FeedInsertWorker.push_bulk(follows) do |follow|
[@status.id, follow.account_id, 'tags', { 'update' => update? }] [@status.id, follow.account_id, 'tags', { 'update' => update? }]
end end

Loading…
Cancel
Save