also store notif counts while at it

This commit is contained in:
Bruno Windels 2020-08-20 17:07:02 +02:00
parent da947fa0d0
commit 7992607442

View File

@ -34,6 +34,12 @@ function applySyncResponse(data, roomResponse, membership) {
} }
data = timeline.events.reduce(processEvent, data); 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; return data;
} }
@ -112,6 +118,8 @@ class SummaryData {
this.hasFetchedMembers = copy ? copy.hasFetchedMembers : false; this.hasFetchedMembers = copy ? copy.hasFetchedMembers : false;
this.lastPaginationToken = copy ? copy.lastPaginationToken : null; this.lastPaginationToken = copy ? copy.lastPaginationToken : null;
this.avatarUrl = copy ? copy.avatarUrl : null; this.avatarUrl = copy ? copy.avatarUrl : null;
this.notificationCount = copy ? copy.notificationCount : 0;
this.highlightCount = copy ? copy.highlightCount : 0;
this.cloned = copy ? true : false; this.cloned = copy ? true : false;
} }