prevent room summary from being updated every time it is in /sync resp

This commit is contained in:
Bruno Windels 2020-09-24 16:45:28 +02:00
parent 46abafdccc
commit 86df4993e1

View file

@ -58,9 +58,16 @@ function applySyncResponse(data, roomResponse, membership) {
}
const unreadNotifications = roomResponse.unread_notifications;
if (unreadNotifications) {
data = data.cloneIfNeeded();
data.highlightCount = unreadNotifications.highlight_count || 0;
data.notificationCount = unreadNotifications.notification_count;
const highlightCount = unreadNotifications.highlight_count || 0;
if (highlightCount !== data.highlightCount) {
data = data.cloneIfNeeded();
data.highlightCount = highlightCount;
}
const notificationCount = unreadNotifications.notification_count;
if (notificationCount !== data.notificationCount) {
data = data.cloneIfNeeded();
data.notificationCount = notificationCount;
}
}
return data;