about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-08-17 13:37:45 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:18 -0500
commitfd3895b6119b54c0365294653e555fff9d11ba46 (patch)
treebaf161118f6e615be5caac2028da6ce4da044e8b
parent295476d0a81fe03dc06f8742228708f946e62dfc (diff)
[Timelines] Media timeline follows Tavern Mode setting
-rw-r--r--app/services/fan_out_on_write_service.rb15
1 files changed, 10 insertions, 5 deletions
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