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

Use stable API prefix for 3PID APIs when supported

If the server advertises spec version r0.6.0, it must have the 3PID APIs
available under the stable API prefix.

Fixes https://github.com/vector-im/riot-web/issues/11246
This commit is contained in:
J. Ryan Stinnett
2019-11-06 18:02:10 +00:00
parent 35adb75d80
commit 20f5c3ea28
2 changed files with 22 additions and 12 deletions

View File

@@ -4210,6 +4210,16 @@ MatrixClient.prototype.getVersions = async function() {
return this._serverVersionsCache;
};
/**
* Check if a particular spec version is supported by the server.
* @param {string} version The spec version (such as "r0.5.0") to check for.
* @return {Promise<bool>} Whether it is supported
*/
MatrixClient.prototype.isVersionSupported = async function(version) {
const { versions } = await this.getVersions();
return versions && versions.includes(version);
};
/**
* Query the server to see if it support members lazy loading
* @return {Promise<boolean>} true if server supports lazy loading