about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-02-02 00:03:31 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-02-02 00:03:31 +0100
commitd9ca46b464dc5a5eb0ad308809c15a79dcd17ada (patch)
tree481d65b29b53d84314f7783c1eb0f4b122e7a7ef /app/services
parent1da0ce5c7cf6a5b90e28a810c8b3ef4003239383 (diff)
Cleaning up format of broadcast real-time messages, removing
redis-backed "mentions" timeline as redundant (given notifications)
Diffstat (limited to 'app/services')
-rw-r--r--app/services/fan_out_on_write_service.rb15
-rw-r--r--app/services/notify_service.rb2
-rw-r--r--app/services/remove_status_service.rb6
3 files changed, 6 insertions, 17 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index 4f387c6c2..79c7bf248 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -6,7 +6,6 @@ class FanOutOnWriteService < BaseService
   def call(status)
     deliver_to_self(status) if status.account.local?
     deliver_to_followers(status)
-    deliver_to_mentioned(status)
 
     return if status.account.silenced? || !status.public_visibility? || status.reblog?
 
@@ -33,25 +32,15 @@ class FanOutOnWriteService < BaseService
     end
   end
 
-  def deliver_to_mentioned(status)
-    Rails.logger.debug "Delivering status #{status.id} to mentioned accounts"
-
-    status.mentions.includes(:account).each do |mention|
-      mentioned_account = mention.account
-      next if !mentioned_account.local? || FeedManager.instance.filter?(:mentions, status, mentioned_account)
-      FeedManager.instance.push(:mentions, mentioned_account, status)
-    end
-  end
-
   def deliver_to_hashtags(status)
     Rails.logger.debug "Delivering status #{status.id} to hashtags"
     status.tags.find_each do |tag|
-      FeedManager.instance.broadcast("hashtag:#{tag.name}", type: 'update', id: status.id)
+      FeedManager.instance.broadcast("hashtag:#{tag.name}", event: 'update', payload: status.id)
     end
   end
 
   def deliver_to_public(status)
     Rails.logger.debug "Delivering status #{status.id} to public timeline"
-    FeedManager.instance.broadcast(:public, type: 'update', id: status.id)
+    FeedManager.instance.broadcast(:public, event: 'update', payload: status.id)
   end
 end
diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb
index d1504cadf..0cc3cd618 100644
--- a/app/services/notify_service.rb
+++ b/app/services/notify_service.rb
@@ -51,7 +51,7 @@ class NotifyService < BaseService
   def create_notification
     @notification.save!
     return unless @notification.browserable?
-    FeedManager.instance.broadcast(@recipient.id, type: 'notification', message: FeedManager.instance.inline_render(@recipient, 'api/v1/notifications/show', @notification))
+    FeedManager.instance.broadcast(@recipient.id, event: 'notification', payload: FeedManager.instance.inline_render(@recipient, 'api/v1/notifications/show', @notification))
   end
 
   def send_email
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb
index 7aca24d12..48e8dd3b8 100644
--- a/app/services/remove_status_service.rb
+++ b/app/services/remove_status_service.rb
@@ -59,17 +59,17 @@ class RemoveStatusService < BaseService
       redis.zremrangebyscore(FeedManager.instance.key(type, receiver.id), status.id, status.id)
     end
 
-    FeedManager.instance.broadcast(receiver.id, type: 'delete', id: status.id)
+    FeedManager.instance.broadcast(receiver.id, event: 'delete', payload: status.id)
   end
 
   def remove_from_hashtags(status)
     status.tags.each do |tag|
-      FeedManager.instance.broadcast("hashtag:#{tag.name}", type: 'delete', id: status.id)
+      FeedManager.instance.broadcast("hashtag:#{tag.name}", event: 'delete', payload: status.id)
     end
   end
 
   def remove_from_public(status)
-    FeedManager.instance.broadcast(:public, type: 'delete', id: status.id)
+    FeedManager.instance.broadcast(:public, event: 'delete', payload: status.id)
   end
 
   def redis