2
0

Fix stale interaction counts being served for quotes over streaming (#35967)

This commit is contained in:
Claire
2025-09-01 22:12:20 +02:00
committed by GitHub
parent 314d5f0d7a
commit 6e09dd10a7

View File

@@ -74,6 +74,16 @@ class StatusCacheHydrator
# TODO: performance optimization by not loading `Account` twice # TODO: performance optimization by not loading `Account` twice
payload[:quote_approval][:current_user] = status.quote_policy_for_account(Account.find_by(id: account_id)) if payload[:quote_approval] payload[:quote_approval][:current_user] = status.quote_policy_for_account(Account.find_by(id: account_id)) if payload[:quote_approval]
payload[:quote] = hydrate_quote_payload(payload[:quote], status.quote, account_id, nested:) if payload[:quote] payload[:quote] = hydrate_quote_payload(payload[:quote], status.quote, account_id, nested:) if payload[:quote]
# Nested statuses are more likely to have a stale cache
fill_status_stats(payload, status) if nested
end
def fill_status_stats(payload, status)
payload[:replies_count] = status.replies_count
payload[:reblogs_count] = status.untrusted_reblogs_count || status.reblogs_count
payload[:favourites_count] = status.untrusted_favourites_count || status.favourites_count
payload[:quotes_count] = status.quotes_count
end end
def hydrate_quote_payload(empty_payload, quote, account_id, nested: false) def hydrate_quote_payload(empty_payload, quote, account_id, nested: false)