You've already forked element-web
mirror of
https://github.com/element-hq/element-web.git
synced 2025-11-29 21:23:11 +03:00
Merge pull request #178 from matrix-org/rav/reset_timeline
Reload the timeline when we get a gappy sync
This commit is contained in:
@@ -116,6 +116,7 @@ var TimelinePanel = React.createClass({
|
|||||||
|
|
||||||
this.dispatcherRef = dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline);
|
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.redaction", this.onRoomRedaction);
|
||||||
|
|
||||||
this._initTimeline(this.props);
|
this._initTimeline(this.props);
|
||||||
@@ -145,6 +146,7 @@ var TimelinePanel = React.createClass({
|
|||||||
var client = MatrixClientPeg.get();
|
var client = MatrixClientPeg.get();
|
||||||
if (client) {
|
if (client) {
|
||||||
client.removeListener("Room.timeline", this.onRoomTimeline);
|
client.removeListener("Room.timeline", this.onRoomTimeline);
|
||||||
|
client.removeListener("Room.timelineReset", this.onRoomTimelineReset);
|
||||||
client.removeListener("Room.redaction", this.onRoomRedaction);
|
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) {
|
onRoomRedaction: function(ev, room) {
|
||||||
if (this.unmounted) return;
|
if (this.unmounted) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user