From 7aa4bd7f46b8a263103ac9c70b57452186137d3f Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 18 Dec 2015 17:49:42 +0000 Subject: [PATCH] Propagate unread notif count from sync to the room object --- lib/sync.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/sync.js b/lib/sync.js index 4d1cd71e963..cb91c46d482 100644 --- a/lib/sync.js +++ b/lib/sync.js @@ -246,7 +246,8 @@ SyncApi.prototype._sync = function(syncOptions, attempt) { // state: { events: [] }, // timeline: { events: [], prev_batch: $token, limited: true }, // ephemeral: { events: [] }, - // account_data: { events: [] } + // account_data: { events: [] }, + // unread_notification_count: 0 // } // }, // leave: { @@ -326,6 +327,9 @@ SyncApi.prototype._sync = function(syncOptions, attempt) { var ephemeralEvents = self._mapSyncEventsFormat(joinObj.ephemeral); var accountDataEvents = self._mapSyncEventsFormat(joinObj.account_data); + // we do this first so it's correct when any of the events fire + room.unread_notification_count = joinObj.unread_notification_count; + joinObj.timeline = joinObj.timeline || {}; if (joinObj.timeline.limited) {