1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

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.
This commit is contained in:
Richard van der Hoff
2016-03-18 20:59:23 +00:00
parent e15a2d138c
commit ad9daecbd4

View File

@@ -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);
}