diff options
Diffstat (limited to 'app/services/fan_out_on_write_service.rb')
-rw-r--r-- | app/services/fan_out_on_write_service.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 4f847e293..46feec5aa 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -44,6 +44,7 @@ class FanOutOnWriteService < BaseService else deliver_to_mentioned_followers! deliver_to_conversation! + deliver_to_direct_timelines! end end @@ -54,6 +55,7 @@ class FanOutOnWriteService < BaseService def deliver_to_self! FeedManager.instance.push_to_home(@account, @status, update: update?) if @account.local? + FeedManager.instance.push_to_direct(@account, @status, update: update?) if @account.local? && @status.direct_visibility? end def notify_mentioned_accounts! @@ -88,6 +90,12 @@ class FanOutOnWriteService < BaseService end end + def deliver_to_direct_timelines! + FeedInsertWorker.push_bulk(@status.mentions.includes(:account).map(&:account).select { |mentioned_account| mentioned_account.local? }) do |account| + [@status.id, account.id, 'direct', { 'update' => update? }] + end + end + def broadcast_to_hashtag_streams! @status.tags.pluck(:name).each do |hashtag| Redis.current.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}", anonymous_payload) @@ -96,7 +104,7 @@ class FanOutOnWriteService < BaseService end def broadcast_to_public_streams! - return if @status.reply? && @status.in_reply_to_account_id != @account.id + return if @status.reply? && @status.in_reply_to_account_id != @account.id && !Setting.show_replies_in_public_timelines Redis.current.publish('timeline:public', anonymous_payload) Redis.current.publish(@status.local? ? 'timeline:public:local' : 'timeline:public:remote', anonymous_payload) @@ -123,6 +131,6 @@ class FanOutOnWriteService < BaseService end def broadcastable? - @status.public_visibility? && !@status.reblog? && !@account.silenced? + @status.public_visibility? && !@account.silenced? && (!@status.reblog? || Setting.show_reblogs_in_public_timelines) end end |