pl-fe: Fix counting deduplicated notifications

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-09-10 13:01:19 +02:00
parent 524192c4f0
commit 6d8a0a5640

View file

@ -128,7 +128,7 @@ type MinifiedNotification = ReturnType<typeof minifyNotification>;
// Count how many notifications appear after the given ID (for unread count)
const countFuture = (notifications: ImmutableOrderedMap<string, MinifiedNotification>, lastId: string | number) =>
notifications.reduce((acc, notification) => {
if (parseId(notification.id) > parseId(lastId)) {
if (!notification.duplicate && parseId(notification.id) > parseId(lastId)) {
return acc + 1;
} else {
return acc;
@ -138,7 +138,7 @@ const countFuture = (notifications: ImmutableOrderedMap<string, MinifiedNotifica
const importNotification = (state: State, notification: Notification) => {
const top = state.top;
if (!top) state = state.update('unread', unread => unread + 1);
if (!top && !notification.duplicate) state = state.update('unread', unread => unread + 1);
return state.update('items', map => {
if (top && map.size > 40) {