From 4ad2abff3efec683d5db988598676f4fc6c5e03a Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 13 Aug 2018 15:11:19 +0200 Subject: [PATCH 1/2] use sync token for /members request, as synapse expects it now --- src/models/room.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/models/room.js b/src/models/room.js index 2fbe58cbc9f..d5b504f0bef 100644 --- a/src/models/room.js +++ b/src/models/room.js @@ -215,14 +215,6 @@ Room.prototype.getLiveTimeline = function() { return this.getUnfilteredTimelineSet().getLiveTimeline(); }; -/** - * @return {string} the id of the last event in the live timeline - */ -Room.prototype.getLastEventId = function() { - const liveEvents = this.getLiveTimeline().getEvents(); - return liveEvents.length ? liveEvents[liveEvents.length - 1].getId() : undefined; -}; - /** * @param {string} myUserId the user id for the logged in member * @return {string} the membership type (join | leave | invite) for the logged in user @@ -268,10 +260,11 @@ Room.prototype.setSyncedMembership = function(membership) { }; Room.prototype._loadMembersFromServer = async function() { + const lastSyncToken = this._client.store.getSyncToken(); const queryString = utils.encodeParams({ membership: "join", not_membership: "leave", - at: this.getLastEventId(), + at: lastSyncToken, }); const path = utils.encodeUri("/rooms/$roomId/members?" + queryString, {$roomId: this.roomId}); From d5a05a0eda440f6ea088d9c54811877d3baa4ad9 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 13 Aug 2018 15:15:56 +0200 Subject: [PATCH 2/2] fix tests --- spec/unit/room.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/unit/room.spec.js b/spec/unit/room.spec.js index 4e40ed53daf..eb5ba5a5145 100644 --- a/spec/unit/room.spec.js +++ b/spec/unit/room.spec.js @@ -1342,6 +1342,7 @@ describe("Room", function() { this.storedMembers = memberEvents; return Promise.resolve(); }, + getSyncToken: () => "sync_token", }, }; }