pl-fe: Fix counting deduplicated notifications
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
524192c4f0
commit
6d8a0a5640
1 changed files with 2 additions and 2 deletions
|
@ -128,7 +128,7 @@ type MinifiedNotification = ReturnType<typeof minifyNotification>;
|
||||||
// Count how many notifications appear after the given ID (for unread count)
|
// Count how many notifications appear after the given ID (for unread count)
|
||||||
const countFuture = (notifications: ImmutableOrderedMap<string, MinifiedNotification>, lastId: string | number) =>
|
const countFuture = (notifications: ImmutableOrderedMap<string, MinifiedNotification>, lastId: string | number) =>
|
||||||
notifications.reduce((acc, notification) => {
|
notifications.reduce((acc, notification) => {
|
||||||
if (parseId(notification.id) > parseId(lastId)) {
|
if (!notification.duplicate && parseId(notification.id) > parseId(lastId)) {
|
||||||
return acc + 1;
|
return acc + 1;
|
||||||
} else {
|
} else {
|
||||||
return acc;
|
return acc;
|
||||||
|
@ -138,7 +138,7 @@ const countFuture = (notifications: ImmutableOrderedMap<string, MinifiedNotifica
|
||||||
const importNotification = (state: State, notification: Notification) => {
|
const importNotification = (state: State, notification: Notification) => {
|
||||||
const top = state.top;
|
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 => {
|
return state.update('items', map => {
|
||||||
if (top && map.size > 40) {
|
if (top && map.size > 40) {
|
||||||
|
|
Loading…
Reference in a new issue