diff --git a/src/controllers/organisms/RoomList.js b/src/controllers/organisms/RoomList.js index a07f6d47..e4909323 100644 --- a/src/controllers/organisms/RoomList.js +++ b/src/controllers/organisms/RoomList.js @@ -8,6 +8,7 @@ var RoomTile = ComponentBroker.get("molecules/RoomTile"); module.exports = { componentWillMount: function() { var cli = MatrixClientPeg.get(); + cli.on("Room", this.onRoom); cli.on("Room.timeline", this.onRoomTimeline); this.setState({ @@ -18,6 +19,7 @@ module.exports = { componentWillUnmount: function() { if (MatrixClientPeg.get()) { + MatrixClientPeg.get().removeListener("Room", this.onRoom); MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline); } }, @@ -29,6 +31,13 @@ module.exports = { }); }, + onRoom: function(room) { + var cli = MatrixClientPeg.get(); + this.setState({ + roomList: cli.getRooms(), + }); + }, + onRoomTimeline: function(ev, room, toStartOfTimeline) { if (room.roomId == this.props.selectedRoom) return; if (ev.getSender() == MatrixClientPeg.get().credentials.userId) return; @@ -51,6 +60,7 @@ module.exports = { key={room.roomId} selected={selected} unread={that.state.activityMap[room.roomId] === 1} + highlight={that.state.activityMap[room.roomId] === 2} /> ); }); diff --git a/src/controllers/templates/Login.js b/src/controllers/templates/Login.js index b028c420..dc0ae97d 100644 --- a/src/controllers/templates/Login.js +++ b/src/controllers/templates/Login.js @@ -1,3 +1,5 @@ +var React = require('react'); + var MatrixClientPeg = require("../../MatrixClientPeg"); var Matrix = require("matrix-js-sdk");