about summary refs log tree commit diff
path: root/app/services/fan_out_on_write_service.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-02-06 23:46:14 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-02-06 23:46:14 +0100
commitc8252759df98f41860b0580b029d9efa374c7125 (patch)
treec9dbd102aefe51420c90e8564b435e04ebb266aa /app/services/fan_out_on_write_service.rb
parent347a153b3dc73068aedf7510c395cc350a553629 (diff)
Add streaming API channels for local-only statuses
Diffstat (limited to 'app/services/fan_out_on_write_service.rb')
-rw-r--r--app/services/fan_out_on_write_service.rb12
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 13aad4632..71f6cbca1 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -34,13 +34,21 @@ class FanOutOnWriteService < BaseService
 
   def deliver_to_hashtags(status)
     Rails.logger.debug "Delivering status #{status.id} to hashtags"
+
+    payload = FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status)
+
     status.tags.find_each do |tag|
-      FeedManager.instance.broadcast("hashtag:#{tag.name}", event: 'update', payload: FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status))
+      FeedManager.instance.broadcast("hashtag:#{tag.name}", event: 'update', payload: payload)
+      FeedManager.instance.broadcast("hashtag:#{tag.name}:local", event: 'update', payload: payload) if status.account.local?
     end
   end
 
   def deliver_to_public(status)
     Rails.logger.debug "Delivering status #{status.id} to public timeline"
-    FeedManager.instance.broadcast(:public, event: 'update', payload: FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status))
+
+    payload = FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status)
+
+    FeedManager.instance.broadcast(:public, event: 'update', payload: payload)
+    FeedManager.instance.broadcast('public:local', event: 'update', payload: payload) if status.account.local?
   end
 end