You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
add parameter to getIdentityServerUrl to strip the protocol for invites
use new getIdentityServerUrl param in inviteByThreePid
This commit is contained in:
@@ -89,9 +89,14 @@ MatrixBaseApis.prototype.getHomeserverUrl = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Identity Server URL of this client
|
* Get the Identity Server URL of this client
|
||||||
|
* @param {boolean} stripProto whether or not to strip the protocol from the URL
|
||||||
* @return {string} Identity Server URL of this client
|
* @return {string} Identity Server URL of this client
|
||||||
*/
|
*/
|
||||||
MatrixBaseApis.prototype.getIdentityServerUrl = function() {
|
MatrixBaseApis.prototype.getIdentityServerUrl = function(stripProto=false) {
|
||||||
|
if (stripProto && (this.idBaseUrl.startsWith("http://") ||
|
||||||
|
this.idBaseUrl.startsWith("https://"))) {
|
||||||
|
return this.idBaseUrl.split("://")[1];
|
||||||
|
}
|
||||||
return this.idBaseUrl;
|
return this.idBaseUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1547,18 +1547,13 @@ MatrixClient.prototype.inviteByThreePid = function(roomId, medium, address, call
|
|||||||
{ $roomId: roomId },
|
{ $roomId: roomId },
|
||||||
);
|
);
|
||||||
|
|
||||||
let identityServerUrl = this.getIdentityServerUrl();
|
const identityServerUrl = this.getIdentityServerUrl(true);
|
||||||
if (!identityServerUrl) {
|
if (!identityServerUrl) {
|
||||||
return Promise.reject(new MatrixError({
|
return Promise.reject(new MatrixError({
|
||||||
error: "No supplied identity server URL",
|
error: "No supplied identity server URL",
|
||||||
errcode: "ORG.MATRIX.JSSDK_MISSING_PARAM",
|
errcode: "ORG.MATRIX.JSSDK_MISSING_PARAM",
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (identityServerUrl.indexOf("http://") === 0 ||
|
|
||||||
identityServerUrl.indexOf("https://") === 0) {
|
|
||||||
// this request must not have the protocol part because reasons
|
|
||||||
identityServerUrl = identityServerUrl.split("://")[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._http.authedRequest(callback, "POST", path, undefined, {
|
return this._http.authedRequest(callback, "POST", path, undefined, {
|
||||||
id_server: identityServerUrl,
|
id_server: identityServerUrl,
|
||||||
|
|||||||
Reference in New Issue
Block a user