Only render public payload once in FanOutOnWrite
This commit is contained in:
parent
cfe91ac984
commit
220bc48e8e
|
@ -16,6 +16,7 @@ class FanOutOnWriteService < BaseService
|
||||||
|
|
||||||
return if status.account.silenced? || !status.public_visibility? || status.reblog?
|
return if status.account.silenced? || !status.public_visibility? || status.reblog?
|
||||||
|
|
||||||
|
render_anonymous_payload(status)
|
||||||
deliver_to_hashtags(status)
|
deliver_to_hashtags(status)
|
||||||
|
|
||||||
return if status.reply? && status.in_reply_to_account_id != status.account_id
|
return if status.reply? && status.in_reply_to_account_id != status.account_id
|
||||||
|
@ -48,23 +49,23 @@ class FanOutOnWriteService < BaseService
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render_anonymous_payload(status)
|
||||||
|
@payload = FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status)
|
||||||
|
end
|
||||||
|
|
||||||
def deliver_to_hashtags(status)
|
def deliver_to_hashtags(status)
|
||||||
Rails.logger.debug "Delivering status #{status.id} to hashtags"
|
Rails.logger.debug "Delivering status #{status.id} to hashtags"
|
||||||
|
|
||||||
payload = FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status)
|
|
||||||
|
|
||||||
status.tags.pluck(:name).each do |hashtag|
|
status.tags.pluck(:name).each do |hashtag|
|
||||||
FeedManager.instance.broadcast("hashtag:#{hashtag}", event: 'update', payload: payload)
|
FeedManager.instance.broadcast("hashtag:#{hashtag}", event: 'update', payload: @payload)
|
||||||
FeedManager.instance.broadcast("hashtag:#{hashtag}:local", event: 'update', payload: payload) if status.account.local?
|
FeedManager.instance.broadcast("hashtag:#{hashtag}:local", event: 'update', payload: @payload) if status.account.local?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def deliver_to_public(status)
|
def deliver_to_public(status)
|
||||||
Rails.logger.debug "Delivering status #{status.id} to public timeline"
|
Rails.logger.debug "Delivering status #{status.id} to public timeline"
|
||||||
|
|
||||||
payload = FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status)
|
FeedManager.instance.broadcast(:public, event: 'update', payload: @payload)
|
||||||
|
FeedManager.instance.broadcast('public:local', event: 'update', payload: @payload) if status.account.local?
|
||||||
FeedManager.instance.broadcast(:public, event: 'update', payload: payload)
|
|
||||||
FeedManager.instance.broadcast('public:local', event: 'update', payload: payload) if status.account.local?
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,5 +13,7 @@ class AfterRemoteFollowRequestWorker
|
||||||
|
|
||||||
follow_request.destroy
|
follow_request.destroy
|
||||||
FollowService.new.call(follow_request.account, updated_account.acct)
|
FollowService.new.call(follow_request.account, updated_account.acct)
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,5 +13,7 @@ class AfterRemoteFollowWorker
|
||||||
|
|
||||||
follow.destroy
|
follow.destroy
|
||||||
FollowService.new.call(follow.account, updated_account.acct)
|
FollowService.new.call(follow.account, updated_account.acct)
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Reference in a new issue