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-04-06 02:26:59 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-04-06 02:26:59 +0200
commitdbd529109ea95df43aefa514c312d7397e7fc713 (patch)
tree7b1223bd4bcac5468f2efb69c3b26ef78322259e /app/services/fan_out_on_write_service.rb
parentdea6e47de07fa027c0f754d876bbfca758f86305 (diff)
Fix notifications delivered to wrong pubsub channel, optimized RemoveStatusService,
slightly optimized FanOutOnWriteService again
Diffstat (limited to 'app/services/fan_out_on_write_service.rb')
-rw-r--r--app/services/fan_out_on_write_service.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index c63fcc1fe..a25c20c93 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -51,21 +51,22 @@ class FanOutOnWriteService < BaseService
 
   def render_anonymous_payload(status)
     @payload = InlineRenderer.render(status, nil, 'api/v1/statuses/show')
+    @payload = Oj.dump(event: :update, payload: @payload)
   end
 
   def deliver_to_hashtags(status)
     Rails.logger.debug "Delivering status #{status.id} to hashtags"
 
     status.tags.pluck(:name).each do |hashtag|
-      Redis.current.publish("hashtag:#{hashtag}", Oj.dump(event: :update, payload: @payload))
-      Redis.current.publish("hashtag:#{hashtag}:local", Oj.dump(event: :update, payload: @payload)) if status.account.local?
+      Redis.current.publish("hashtag:#{hashtag}", @payload)
+      Redis.current.publish("hashtag:#{hashtag}:local", @payload) if status.local?
     end
   end
 
   def deliver_to_public(status)
     Rails.logger.debug "Delivering status #{status.id} to public timeline"
 
-    Redis.current.publish('public', Oj.dump(event: 'update', payload: @payload))
-    Redis.current.publish('public:local', Oj.dump(event: 'update', payload: @payload)) if status.account.local?
+    Redis.current.publish('public', @payload)
+    Redis.current.publish('public:local', @payload) if status.local?
   end
 end