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 2554756a5..8e74e152e 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -49,6 +49,7 @@ class FanOutOnWriteService < BaseService else deliver_to_mentioned_followers! deliver_to_conversation! + deliver_to_direct_timelines! end end @@ -63,6 +64,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! @@ -113,6 +115,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.map(&:name).each do |hashtag| redis.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}", anonymous_payload) @@ -121,7 +129,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.publish('timeline:public', anonymous_payload) redis.publish(@status.local? ? 'timeline:public:local' : 'timeline:public:remote', anonymous_payload) @@ -156,6 +164,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 |