From 9a42d00c122c9e33a2994b0950bced21bab0eb82 Mon Sep 17 00:00:00 2001 From: Echo Date: Mon, 10 Nov 2025 16:10:24 +0100 Subject: [PATCH] Ensure the boost button shows a numeric value (#36805) --- .../components/status/boost_button.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/javascript/mastodon/components/status/boost_button.tsx b/app/javascript/mastodon/components/status/boost_button.tsx index 6a1a875ec9..723fa32aa1 100644 --- a/app/javascript/mastodon/components/status/boost_button.tsx +++ b/app/javascript/mastodon/components/status/boost_button.tsx @@ -112,6 +112,18 @@ const BoostOrQuoteMenu: FC = ({ status, counters }) => { const statusId = status.get('id') as string; const wasBoosted = !!status.get('reblogged'); + let count: number | undefined; + if (counters) { + count = 0; + // Ensure count is a valid integer. + if (Number.isInteger(status.get('reblogs_count'))) { + count += status.get('reblogs_count') as number; + } + if (Number.isInteger(status.get('quotes_count'))) { + count += status.get('quotes_count') as number; + } + } + const showLoginPrompt = useCallback(() => { dispatch( openModal({ @@ -187,12 +199,7 @@ const BoostOrQuoteMenu: FC = ({ status, counters }) => { )} icon='retweet' iconComponent={boostIcon} - counter={ - counters - ? (status.get('reblogs_count') as number) + - (status.get('quotes_count') as number) - : undefined - } + counter={count} active={isReblogged} />