Fix unread notification count

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-05-03 17:15:01 +02:00
parent a64bd537f4
commit 4b3cc9e67b
2 changed files with 6 additions and 2 deletions

View File

@ -373,9 +373,13 @@ const markReadNotifications = () =>
const state = getState();
const topNotificationId = state.notifications.items.first()?.id;
const lastReadId = state.notifications.lastRead;
let lastReadId = state.notifications.lastRead;
const v = parseVersion(state.instance.version);
if (typeof lastReadId === 'string' && lastReadId?.includes('+')) {
lastReadId = lastReadId.split('+')[0];
}
if (topNotificationId && (lastReadId === -1 || compareId(topNotificationId, lastReadId) > 0)) {
const marker = {
notifications: {

View File

@ -107,7 +107,7 @@ const isValid = (notification: APIEntity) => {
// Count how many notifications appear after the given ID (for unread count)
const countFuture = (notifications: ImmutableOrderedMap<string, NotificationRecord>, lastId: string | number) => {
return notifications.reduce((acc, notification) => {
if (parseId(notification.get('id')) > parseId(lastId)) {
if (parseId(notification.get('id').split('+')[0]) > parseId(lastId)) {
return acc + 1;
} else {
return acc;