1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

don't double-add events in Room.addEventsToTimeline

also, ignore notif events from initialSync as their time ordering is wrong
This commit is contained in:
Matthew Hodgson
2016-09-10 00:52:39 +01:00
parent 2c6409a67a
commit b69f6cf70a
3 changed files with 12 additions and 9 deletions

View File

@@ -808,8 +808,12 @@ SyncApi.prototype._processSyncResponse = function(syncToken, data) {
accountDataEvents.forEach(function(e) { client.emit("event", e); });
});
// update the notification timeline, if appropriate
if (this._notifEvents.length) {
// update the notification timeline, if appropriate.
// we only do this for live events, as otherwise we can't order them sanely
// in the timeline relative to ones paginated in by /notifications.
// XXX: we could fix this by making EventTimeline support chronological
// ordering... but it doesn't, right now.
if (syncToken && this._notifEvents.length) {
this._notifEvents.sort(function(a, b) {
return a.getTs() - b.getTs();
});