diff options
Diffstat (limited to 'app/services/fan_out_on_write_service.rb')
-rw-r--r-- | app/services/fan_out_on_write_service.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index f3e9c855d..de7c031d8 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -6,14 +6,17 @@ class FanOutOnWriteService < BaseService def call(status) raise Mastodon::RaceConditionError if status.visibility.nil? + deliver_to_self(status) if status.account.local? + render_anonymous_payload(status) if status.direct_visibility? + deliver_to_mentioned_followers(status) + deliver_to_direct_timelines(status) deliver_to_own_conversation(status) elsif status.limited_visibility? deliver_to_mentioned_followers(status) else - deliver_to_self(status) if status.account.local? deliver_to_followers(status) deliver_to_lists(status) end @@ -91,6 +94,16 @@ class FanOutOnWriteService < BaseService Redis.current.publish('timeline:public:local:media', @payload) if status.local? end + def deliver_to_direct_timelines(status) + Rails.logger.debug "Delivering status #{status.id} to direct timelines" + + status.mentions.includes(:account).each do |mention| + Redis.current.publish("timeline:direct:#{mention.account.id}", @payload) if mention.account.local? + end + + Redis.current.publish("timeline:direct:#{status.account.id}", @payload) if status.account.local? + end + def deliver_to_own_conversation(status) AccountConversation.add_status(status.account, status) end |