also expose highlight count

This commit is contained in:
Bruno Windels 2020-08-21 15:50:32 +02:00
parent 0d8ff34c55
commit 831f4188f7
2 changed files with 9 additions and 1 deletions

View File

@ -201,6 +201,10 @@ export class Room extends EventEmitter {
return this._summary.notificationCount; return this._summary.notificationCount;
} }
get highlightCount() {
return this._summary.highlightCount;
}
async _getLastEventId() { async _getLastEventId() {
const lastKey = this._syncWriter.lastMessageKey; const lastKey = this._syncWriter.lastMessageKey;
if (lastKey) { if (lastKey) {

View File

@ -44,7 +44,7 @@ function applySyncResponse(data, roomResponse, membership, isInitialSync, isTime
const unreadNotifications = roomResponse.unread_notifications; const unreadNotifications = roomResponse.unread_notifications;
if (unreadNotifications) { if (unreadNotifications) {
data = data.cloneIfNeeded(); data = data.cloneIfNeeded();
data.highlightCount = unreadNotifications.highlight_count; data.highlightCount = unreadNotifications.highlight_count || 0;
data.notificationCount = unreadNotifications.notification_count; data.notificationCount = unreadNotifications.notification_count;
} }
@ -182,6 +182,10 @@ export class RoomSummary {
return this._data.notificationCount; return this._data.notificationCount;
} }
get highlightCount() {
return this._data.highlightCount;
}
get lastMessage() { get lastMessage() {
return this._data.lastMessageBody; return this._data.lastMessageBody;
} }