0
0
Fork 0

Use integers and not numbers in notification policy API counters (#29810)

This commit is contained in:
Renaud Chaput 2024-04-02 12:06:26 +02:00 committed by GitHub
parent d05f62391d
commit b4d991adaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 11 deletions

View file

@ -27,7 +27,7 @@ export const FilteredNotificationsBanner = () => {
};
}, [dispatch]);
if (policy === null || policy.getIn(['summary', 'pending_notifications_count']) * 1 === 0) {
if (policy === null || policy.getIn(['summary', 'pending_notifications_count']) === 0) {
return null;
}

View file

@ -70,10 +70,10 @@ export function roundTo10(num: number): number {
return Math.round(num * 0.1) / 0.1;
}
export function toCappedNumber(num: string): string {
if (parseInt(num) > 99) {
return '99+';
export function toCappedNumber(num: number, max = 99): string {
if (num > max) {
return `${max}+`;
} else {
return num;
return num.toString();
}
}