You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
Initial support for specifying which servers to try in joinRoom
This has a bug when using browser-request where the query string for `server_name: [a, b]` comes out as `?server_name=a,b` instead of `?server_name=a&server_name=b`. This is due to browser-request not supporting the same qs options as request, so the qsStringifyOptions do nothing.
This commit is contained in:
@@ -921,6 +921,8 @@ MatrixClient.prototype.isUserIgnored = function(userId) {
|
||||
* </strong> Default: true.
|
||||
* @param {boolean} opts.inviteSignUrl If the caller has a keypair 3pid invite,
|
||||
* the signing URL is passed in this parameter.
|
||||
* @param {string[]} opts.viaServers The server names to try and join through in
|
||||
* addition to those that are automatically chosen.
|
||||
* @param {module:client.callback} callback Optional.
|
||||
* @return {module:client.Promise} Resolves: Room object.
|
||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||
@@ -949,6 +951,13 @@ MatrixClient.prototype.joinRoom = function(roomIdOrAlias, opts, callback) {
|
||||
);
|
||||
}
|
||||
|
||||
const queryString = {};
|
||||
if (opts.viaServers) {
|
||||
queryString["server_name"] = opts.viaServers;
|
||||
}
|
||||
|
||||
const reqOpts = {qsStringifyOptions: {arrayFormat: 'repeat'}};
|
||||
|
||||
const defer = Promise.defer();
|
||||
|
||||
const self = this;
|
||||
@@ -959,7 +968,7 @@ MatrixClient.prototype.joinRoom = function(roomIdOrAlias, opts, callback) {
|
||||
}
|
||||
|
||||
const path = utils.encodeUri("/join/$roomid", { $roomid: roomIdOrAlias});
|
||||
return self._http.authedRequest(undefined, "POST", path, undefined, data);
|
||||
return self._http.authedRequest(undefined, "POST", path, queryString, data, reqOpts);
|
||||
}).then(function(res) {
|
||||
const roomId = res.room_id;
|
||||
const syncApi = new SyncApi(self, self._clientOpts);
|
||||
|
||||
Reference in New Issue
Block a user