From 9dc344999eb27e13362a2e5fae0cdc415c105438 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 8 Apr 2019 15:57:44 -0600 Subject: [PATCH 1/2] Fix highlight notifications for unencrypted rooms A logic error introduced by https://github.com/matrix-org/matrix-js-sdk/pull/886 meant that all unencrypted rooms were not getting highlight notifications. --- src/sync.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sync.js b/src/sync.js index d1e58e14d..0c6c71cac 100644 --- a/src/sync.js +++ b/src/sync.js @@ -1105,8 +1105,8 @@ SyncApi.prototype._processSyncResponse = async function( // bother setting it here. We trust our calculations better than the // server's for this case, and therefore will assume that our non-zero // count is accurate. - if (client.isRoomEncrypted(room.roomId) - && room.getUnreadNotificationCount('highlight') <= 0) { + const encrypted = client.isRoomEncrypted(room.roomId); + if (!encrypted || (encrypted && room.getUnreadNotificationCount('highlight') <= 0)) { room.setUnreadNotificationCount( 'highlight', joinObj.unread_notifications.highlight_count, ); From f72ae490a804214f4f9b4321bd91cb2383f66a7d Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 9 Apr 2019 09:05:20 -0600 Subject: [PATCH 2/2] Appease the linter --- src/sync.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sync.js b/src/sync.js index 0c6c71cac..24e9168b1 100644 --- a/src/sync.js +++ b/src/sync.js @@ -1106,7 +1106,8 @@ SyncApi.prototype._processSyncResponse = async function( // server's for this case, and therefore will assume that our non-zero // count is accurate. const encrypted = client.isRoomEncrypted(room.roomId); - if (!encrypted || (encrypted && room.getUnreadNotificationCount('highlight') <= 0)) { + if (!encrypted + || (encrypted && room.getUnreadNotificationCount('highlight') <= 0)) { room.setUnreadNotificationCount( 'highlight', joinObj.unread_notifications.highlight_count, );