From 5f6fe74ca81431ef865db3aecad5a0d9e6c1131b Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 18 Dec 2015 17:51:17 +0000 Subject: [PATCH] Highlight status is now taken from the server's unread notif count --- src/components/views/rooms/RoomList.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 6a19e21d27..f60cc3a08a 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -52,6 +52,7 @@ module.exports = React.createClass({ cli.on("Room.timeline", this.onRoomTimeline); cli.on("Room.name", this.onRoomName); cli.on("Room.tags", this.onRoomTags); + cli.on("Room.receipt", this.onRoomReceipt); cli.on("RoomState.events", this.onRoomStateEvents); cli.on("RoomMember.name", this.onRoomMemberName); @@ -93,6 +94,7 @@ module.exports = React.createClass({ if (MatrixClientPeg.get()) { MatrixClientPeg.get().removeListener("Room", this.onRoom); MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline); + MatrixClientPeg.get().removeListener("Room.receipt", this.onRoomReceipt); MatrixClientPeg.get().removeListener("Room.name", this.onRoomName); MatrixClientPeg.get().removeListener("RoomState.events", this.onRoomStateEvents); } @@ -139,14 +141,6 @@ module.exports = React.createClass({ if (UnreadStatus.eventTriggersUnreadCount(ev)) { hl = 1; } - - var me = room.getMember(MatrixClientPeg.get().credentials.userId); - var actions = MatrixClientPeg.get().getPushActionsForEvent(ev); - if ((actions && actions.tweaks && actions.tweaks.highlight) || - (me && me.membership == "invite")) - { - hl = 2; - } } var newState = this.getRoomLists(); @@ -163,6 +157,11 @@ module.exports = React.createClass({ this.setState(newState); }, + onRoomReceipt: function(receiptEvent, room) { + // because if we read a notification, it will affect notification count + this.refreshRoomList(); + }, + onRoomName: function(room) { this._delayedRefreshRoomList(); },