Merge pull request #178 from matrix-org/rav/reset_timeline
Reload the timeline when we get a gappy sync
This commit is contained in:
commit
65ecbf93fe
1 changed files with 10 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue