mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 16:59:41 +00:00
[Glitch] Ensure the boost button shows a numeric value
Port 9a42d00c12 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -112,6 +112,18 @@ const BoostOrQuoteMenu: FC<ReblogButtonProps> = ({ status, counters }) => {
|
|||||||
const statusId = status.get('id') as string;
|
const statusId = status.get('id') as string;
|
||||||
const wasBoosted = !!status.get('reblogged');
|
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(() => {
|
const showLoginPrompt = useCallback(() => {
|
||||||
dispatch(
|
dispatch(
|
||||||
openModal({
|
openModal({
|
||||||
@@ -187,12 +199,7 @@ const BoostOrQuoteMenu: FC<ReblogButtonProps> = ({ status, counters }) => {
|
|||||||
)}
|
)}
|
||||||
icon='retweet'
|
icon='retweet'
|
||||||
iconComponent={boostIcon}
|
iconComponent={boostIcon}
|
||||||
counter={
|
counter={count}
|
||||||
counters
|
|
||||||
? (status.get('reblogs_count') as number) +
|
|
||||||
(status.get('quotes_count') as number)
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
active={isReblogged}
|
active={isReblogged}
|
||||||
/>
|
/>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|||||||
Reference in New Issue
Block a user