Merge pull request from matrix-org/rav/reset_timeline

Reload the timeline when we get a gappy sync
This commit is contained in:
Richard van der Hoff 2016-02-26 13:28:20 +00:00
commit 65ecbf93fe

View file

@ -116,6 +116,7 @@ var TimelinePanel = React.createClass({
this.dispatcherRef = dis.register(this.onAction);
MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline);
MatrixClientPeg.get().on("Room.timelineReset", this.onRoomTimelineReset);
MatrixClientPeg.get().on("Room.redaction", this.onRoomRedaction);
this._initTimeline(this.props);
@ -145,6 +146,7 @@ var TimelinePanel = React.createClass({
var client = MatrixClientPeg.get();
if (client) {
client.removeListener("Room.timeline", this.onRoomTimeline);
client.removeListener("Room.timelineReset", this.onRoomTimelineReset);
client.removeListener("Room.redaction", this.onRoomRedaction);
}
},
@ -242,6 +244,14 @@ var TimelinePanel = React.createClass({
}
},
onRoomTimelineReset: function(room) {
if (room !== this.props.room) return;
if (this.refs.messagePanel && this.refs.messagePanel.isAtBottom()) {
this._loadTimeline();
}
},
onRoomRedaction: function(ev, room) {
if (this.unmounted) return;