From 91e5b0dfdbfbf9415e6bff14cbc3a80bc6e53f5c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 26 Sep 2017 00:29:29 +0200 Subject: [PATCH] Send streaming API delete to people mentioned in status (#5103) - Previously they wouldn't receive it unless they were author's followers - Skip unpush from public/hashtag timelines if status wasn't public in the first place --- app/services/batched_remove_status_service.rb | 2 ++ app/services/remove_status_service.rb | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb index e1e845bc0d..2fd623922f 100644 --- a/app/services/batched_remove_status_service.rb +++ b/app/services/batched_remove_status_service.rb @@ -84,6 +84,8 @@ class BatchedRemoveStatusService < BaseService end def unpush_from_public_timelines(status) + return unless status.public_visibility? + payload = @json_payloads[status.id] redis.pipelined do diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index 5f45fb3ab8..14f24908c8 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -14,6 +14,7 @@ class RemoveStatusService < BaseService remove_from_self if status.account.local? remove_from_followers + remove_from_affected remove_reblogs remove_from_hashtags remove_from_public @@ -38,6 +39,12 @@ class RemoveStatusService < BaseService end end + def remove_from_affected + @mentions.map(&:account).select(&:local?).each do |account| + Redis.current.publish("timeline:#{account.id}", @payload) + end + end + def remove_from_remote_affected # People who got mentioned in the status, or who # reblogged it from someone else might not follow @@ -105,6 +112,8 @@ class RemoveStatusService < BaseService end def remove_from_hashtags + return unless @status.public_visibility? + @tags.each do |hashtag| Redis.current.publish("timeline:hashtag:#{hashtag}", @payload) Redis.current.publish("timeline:hashtag:#{hashtag}:local", @payload) if @status.local? @@ -112,6 +121,8 @@ class RemoveStatusService < BaseService end def remove_from_public + return unless @status.public_visibility? + Redis.current.publish('timeline:public', @payload) Redis.current.publish('timeline:public:local', @payload) if @status.local? end