From fd3895b6119b54c0365294653e555fff9d11ba46 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Mon, 17 Aug 2020 13:37:45 -0500 Subject: [Timelines] Media timeline follows Tavern Mode setting --- app/services/fan_out_on_write_service.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'app/services') diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index a2948438b..12bfb2d6e 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -26,15 +26,17 @@ class FanOutOnWriteService < BaseService return if status.account.silenced? if status.reblog? - return deliver_to_public(status.reblog) if status.local? && status.reblog.public_visibility? && !status.reblog.account.silenced? - + if status.local? && status.reblog.public_visibility? && !status.reblog.account.silenced? + deliver_to_public(status.reblog) + deliver_to_media(status.reblog) if status.reblog.media_attachments.any? + end return end deliver_to_hashtags(status) if status.distributable? return if !status.public_visibility? || (status.reply? && status.in_reply_to_account_id != status.account_id) - deliver_to_media(status) if status.media_attachments.any? + deliver_to_media(status, true) if status.media_attachments.any? deliver_to_public(status, true) end @@ -104,10 +106,13 @@ class FanOutOnWriteService < BaseService end end - def deliver_to_media(status) + def deliver_to_media(status, tavern = false) + key = "timeline:public:#{status.id}" + return if Redis.current.get(key) + Rails.logger.debug "Delivering status #{status.id} to media timeline" - Redis.current.publish('timeline:public:media', @payload) + Redis.current.publish('timeline:public:media', @payload) if status.local? || !tavern if status.local? Redis.current.publish('timeline:public:local:media', @payload) else -- cgit