Skip to content
Snippets Groups Projects
Commit 91e5b0df authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

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
parent 3b608322
No related branches found
No related tags found
No related merge requests found
...@@ -84,6 +84,8 @@ class BatchedRemoveStatusService < BaseService ...@@ -84,6 +84,8 @@ class BatchedRemoveStatusService < BaseService
end end
def unpush_from_public_timelines(status) def unpush_from_public_timelines(status)
return unless status.public_visibility?
payload = @json_payloads[status.id] payload = @json_payloads[status.id]
redis.pipelined do redis.pipelined do
......
...@@ -14,6 +14,7 @@ class RemoveStatusService < BaseService ...@@ -14,6 +14,7 @@ class RemoveStatusService < BaseService
remove_from_self if status.account.local? remove_from_self if status.account.local?
remove_from_followers remove_from_followers
remove_from_affected
remove_reblogs remove_reblogs
remove_from_hashtags remove_from_hashtags
remove_from_public remove_from_public
...@@ -38,6 +39,12 @@ class RemoveStatusService < BaseService ...@@ -38,6 +39,12 @@ class RemoveStatusService < BaseService
end end
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 def remove_from_remote_affected
# People who got mentioned in the status, or who # People who got mentioned in the status, or who
# reblogged it from someone else might not follow # reblogged it from someone else might not follow
...@@ -105,6 +112,8 @@ class RemoveStatusService < BaseService ...@@ -105,6 +112,8 @@ class RemoveStatusService < BaseService
end end
def remove_from_hashtags def remove_from_hashtags
return unless @status.public_visibility?
@tags.each do |hashtag| @tags.each do |hashtag|
Redis.current.publish("timeline:hashtag:#{hashtag}", @payload) Redis.current.publish("timeline:hashtag:#{hashtag}", @payload)
Redis.current.publish("timeline:hashtag:#{hashtag}:local", @payload) if @status.local? Redis.current.publish("timeline:hashtag:#{hashtag}:local", @payload) if @status.local?
...@@ -112,6 +121,8 @@ class RemoveStatusService < BaseService ...@@ -112,6 +121,8 @@ class RemoveStatusService < BaseService
end end
def remove_from_public def remove_from_public
return unless @status.public_visibility?
Redis.current.publish('timeline:public', @payload) Redis.current.publish('timeline:public', @payload)
Redis.current.publish('timeline:public:local', @payload) if @status.local? Redis.current.publish('timeline:public:local', @payload) if @status.local?
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment