Skip to content

Commit

Permalink
Merge pull request #387 from vector-im/rav/suppress_unread_on_memberc…
Browse files Browse the repository at this point in the history
…hange

Don't mark rooms as unread on m.room.member changes
  • Loading branch information
richvdh committed Nov 19, 2015
2 parents f7fe871 + c42d4f9 commit 3a00334
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,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"
}
}
15 changes: 12 additions & 3 deletions src/controllers/organisms/RoomList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3a00334

Please sign in to comment.