Merge pull request #192 from matrix-org/rav/fix_read_receipts

Make sure we update the timelinepanel when a read-receipt arrives
pull/21833/head
Richard van der Hoff 2016-03-04 17:55:29 +00:00
commit 318bcb1284
1 changed files with 11 additions and 0 deletions

View File

@ -118,6 +118,7 @@ var TimelinePanel = React.createClass({
MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline);
MatrixClientPeg.get().on("Room.timelineReset", this.onRoomTimelineReset);
MatrixClientPeg.get().on("Room.redaction", this.onRoomRedaction);
MatrixClientPeg.get().on("Room.receipt", this.onRoomReceipt);
this._initTimeline(this.props);
},
@ -159,6 +160,7 @@ var TimelinePanel = React.createClass({
client.removeListener("Room.timeline", this.onRoomTimeline);
client.removeListener("Room.timelineReset", this.onRoomTimelineReset);
client.removeListener("Room.redaction", this.onRoomRedaction);
client.removeListener("Room.receipt", this.onRoomReceipt);
}
},
@ -280,6 +282,15 @@ var TimelinePanel = React.createClass({
this.forceUpdate();
},
onRoomReceipt: function(ev, room) {
if (this.unmounted) return;
// ignore events for other rooms
if (room !== this.props.room) return;
this.forceUpdate();
},
sendReadReceipt: function() {
if (!this.refs.messagePanel) return;