From 31df97e486b58c08eb3fdc014bf191b8dde7241c Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 4 Mar 2016 14:47:11 +0000 Subject: [PATCH] Make sure we update the timelinepanel when a read-receipt arrives Fixes https://github.com/vector-im/vector-web/issues/1094 --- src/components/structures/TimelinePanel.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 6d034721a5..5e3e31d1bc 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -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;