From c428129c48ce27a54397c07c77c5299d880a338b Mon Sep 17 00:00:00 2001 From: Echo Date: Mon, 10 Nov 2025 16:10:24 +0100 Subject: [PATCH] [Glitch] Ensure the boost button shows a numeric value Port 9a42d00c122c9e33a2994b0950bced21bab0eb82 to glitch-soc Signed-off-by: Claire --- .../glitch/components/status/boost_button.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/javascript/flavours/glitch/components/status/boost_button.tsx b/app/javascript/flavours/glitch/components/status/boost_button.tsx index 615e716646..110bc956d7 100644 --- a/app/javascript/flavours/glitch/components/status/boost_button.tsx +++ b/app/javascript/flavours/glitch/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} />