From 831f4188f7351ecda99dc517f415f89bbec63371 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 21 Aug 2020 15:50:32 +0200 Subject: [PATCH] also expose highlight count --- src/matrix/room/Room.js | 4 ++++ src/matrix/room/RoomSummary.js | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/matrix/room/Room.js b/src/matrix/room/Room.js index 158299c3..7d482201 100644 --- a/src/matrix/room/Room.js +++ b/src/matrix/room/Room.js @@ -200,6 +200,10 @@ export class Room extends EventEmitter { get notificationCount() { return this._summary.notificationCount; } + + get highlightCount() { + return this._summary.highlightCount; + } async _getLastEventId() { const lastKey = this._syncWriter.lastMessageKey; diff --git a/src/matrix/room/RoomSummary.js b/src/matrix/room/RoomSummary.js index c97034e4..3f13bd1e 100644 --- a/src/matrix/room/RoomSummary.js +++ b/src/matrix/room/RoomSummary.js @@ -44,7 +44,7 @@ function applySyncResponse(data, roomResponse, membership, isInitialSync, isTime const unreadNotifications = roomResponse.unread_notifications; if (unreadNotifications) { data = data.cloneIfNeeded(); - data.highlightCount = unreadNotifications.highlight_count; + data.highlightCount = unreadNotifications.highlight_count || 0; data.notificationCount = unreadNotifications.notification_count; } @@ -182,6 +182,10 @@ export class RoomSummary { return this._data.notificationCount; } + get highlightCount() { + return this._data.highlightCount; + } + get lastMessage() { return this._data.lastMessageBody; }