From ad9daecbd43f46f5fe6abb04c65d2555123a29af Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 18 Mar 2016 20:59:23 +0000 Subject: [PATCH] Pass the right options into SyncApi when peeking When we peek into a room, we create its Room object. We need to make sure it is created with the same options as we would if it were created via the /sync calls. Save the options passed in when startClient is called, and then pass them into the SyncApi each time we create it. --- lib/client.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/client.js b/lib/client.js index ad607a5b3..3f46a29eb 100644 --- a/lib/client.js +++ b/lib/client.js @@ -697,7 +697,7 @@ MatrixClient.prototype.joinRoom = function(roomIdOrAlias, opts, callback) { return self._http.authedRequest(undefined, "POST", path, undefined, data); }).then(function(res) { var roomId = res.room_id; - var syncApi = new SyncApi(self); + var syncApi = new SyncApi(self, self._clientOpts); var room = syncApi.createRoom(roomId); if (opts.syncRoom) { // v2 will do this for us @@ -2313,7 +2313,7 @@ MatrixClient.prototype.peekInRoom = function(roomId) { if (this._peekSync) { this._peekSync.stopPeeking(); } - this._peekSync = new SyncApi(this); + this._peekSync = new SyncApi(this, this._clientOpts); return this._peekSync.peek(roomId); }; @@ -2792,7 +2792,7 @@ MatrixClient.prototype.syncLeftRooms = function() { return this._syncLeftRoomsPromise; // return the ongoing request } var self = this; - var syncApi = new SyncApi(this); + var syncApi = new SyncApi(this, this._clientOpts); this._syncLeftRoomsPromise = syncApi.syncLeftRooms(); // cleanup locks @@ -2946,6 +2946,8 @@ MatrixClient.prototype.startClient = function(opts) { }; } + this._clientOpts = opts; + if (CRYPTO_ENABLED && this.sessionStore !== null) { this.uploadKeys(5); }