From c42d4f901bdfd4e44ca9b6cc523e78e5d7975c54 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 18 Nov 2015 10:46:32 +0000 Subject: [PATCH] Don't mark rooms as unread on m.room.member changes A quick and hacky fix to issue #169. --- package.json | 3 ++- src/controllers/organisms/RoomList.js | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index fb7558ad5a..83010b1e9e 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "parallelshell": "^1.2.0", "rimraf": "^2.4.3", "source-map-loader": "^0.1.5", - "uglifycss": "0.0.15" + "uglifycss": "0.0.15", + "webpack": "^1.12.6" } } diff --git a/src/controllers/organisms/RoomList.js b/src/controllers/organisms/RoomList.js index 37d4a4e4a2..2a01527e78 100644 --- a/src/controllers/organisms/RoomList.js +++ b/src/controllers/organisms/RoomList.js @@ -88,24 +88,33 @@ module.exports = { onRoomTimeline: function(ev, room, toStartOfTimeline) { if (toStartOfTimeline) return; - var newState = this.getRoomLists(); + var hl = 0; if ( room.roomId != this.props.selectedRoom && ev.getSender() != MatrixClientPeg.get().credentials.userId) { - var hl = 1; + // don't mark rooms as unread for just member changes + if (ev.getType() != "m.room.member") { + hl = 1; + } var actions = MatrixClientPeg.get().getPushActionsForEvent(ev); if (actions && actions.tweaks && actions.tweaks.highlight) { hl = 2; } + } + + if (hl > 0) { + var newState = this.getRoomLists(); + // obviously this won't deep copy but this shouldn't be necessary var amap = this.state.activityMap; amap[room.roomId] = Math.max(amap[room.roomId] || 0, hl); newState.activityMap = amap; + + this.setState(newState); } - this.setState(newState); }, onRoomName: function(room) {