From 7992607442cb9d58dbd01e465dffc124b9c9934c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 20 Aug 2020 17:07:02 +0200 Subject: [PATCH] also store notif counts while at it --- src/matrix/room/RoomSummary.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/matrix/room/RoomSummary.js b/src/matrix/room/RoomSummary.js index c48a643a..bef9424c 100644 --- a/src/matrix/room/RoomSummary.js +++ b/src/matrix/room/RoomSummary.js @@ -34,6 +34,12 @@ function applySyncResponse(data, roomResponse, membership) { } data = timeline.events.reduce(processEvent, data); } + const unreadNotifications = roomResponse.unread_notifications; + if (unreadNotifications) { + data = data.cloneIfNeeded(); + data.highlightCount = unreadNotifications.highlight_count; + data.notificationCount = unreadNotifications.notification_count; + } return data; } @@ -112,6 +118,8 @@ class SummaryData { this.hasFetchedMembers = copy ? copy.hasFetchedMembers : false; this.lastPaginationToken = copy ? copy.lastPaginationToken : null; this.avatarUrl = copy ? copy.avatarUrl : null; + this.notificationCount = copy ? copy.notificationCount : 0; + this.highlightCount = copy ? copy.highlightCount : 0; this.cloned = copy ? true : false; }