Fix unread notification count
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
@ -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: {
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user