Fix public unlisted streaming

This commit is contained in:
KMY 2023-03-05 14:42:26 +09:00
parent ed3abf4f2a
commit bb665eb942

View file

@ -17,8 +17,13 @@ class FanOutOnWriteService < BaseService
warm_payload_cache!
fan_out_to_local_recipients!
fan_out_to_public_recipients! if broadcastable?
fan_out_to_public_streams! if broadcastable?
if broadcastable?
fan_out_to_public_recipients!
fan_out_to_public_streams!
elsif broadcastable_unlisted?
fan_out_to_public_recipients!
fan_out_to_public_unlisted_streams!
end
end
private
@ -61,6 +66,11 @@ class FanOutOnWriteService < BaseService
broadcast_to_public_streams!
end
def fan_out_to_public_unlisted_streams!
broadcast_to_hashtag_streams!
broadcast_to_public_unlisted_streams!
end
def deliver_to_self!
FeedManager.instance.push_to_home(@account, @status, update: update?) if @account.local?
end
@ -132,6 +142,16 @@ class FanOutOnWriteService < BaseService
end
end
def broadcast_to_public_unlisted_streams!
return if @status.reply? && @status.in_reply_to_account_id != @account.id
redis.publish(@status.local? ? 'timeline:public:local' : 'timeline:public:remote', anonymous_payload)
if @status.with_media?
redis.publish(@status.local? ? 'timeline:public:local:media' : 'timeline:public:remote:media', anonymous_payload)
end
end
def deliver_to_conversation!
AccountConversation.add_status(@account, @status) unless update?
end
@ -158,4 +178,8 @@ class FanOutOnWriteService < BaseService
def broadcastable?
@status.public_visibility? && !@status.reblog? && !@account.silenced?
end
def broadcastable_unlisted?
@status.public_unlisted_visibility? && !@status.reblog? && !@account.silenced?
end
end