From eeb2c463dcb2ae817b019f0e03d5f067e1e6325e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 16 Sep 2019 14:30:18 -0600 Subject: [PATCH] Check for r0.6.0 support in addition to unstable feature flags To avoid the same problem that happened with lazy-loading (see https://github.com/matrix-org/synapse/issues/5528). Note that as of writing r0.6.0 is not yet released, however it is the next scheduled release of the client-server API. --- src/client.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/client.js b/src/client.js index 0c99c2631..a86b723d8 100644 --- a/src/client.js +++ b/src/client.js @@ -4196,6 +4196,13 @@ MatrixClient.prototype.doesServerSupportLazyLoading = async function() { MatrixClient.prototype.doesServerRequireIdServerParam = async function() { const response = await this.getVersions(); + const versions = response["versions"]; + + // Supporting r0.6.0 is the same as having the flag set to false + if (versions && versions.includes("r0.6.0")) { + return false; + } + const unstableFeatures = response["unstable_features"]; if (unstableFeatures["m.require_identity_server"] === undefined) { return true; @@ -4213,12 +4220,11 @@ MatrixClient.prototype.doesServerRequireIdServerParam = async function() { MatrixClient.prototype.doesServerAcceptIdentityAccessToken = async function() { const response = await this.getVersions(); + const versions = response["versions"]; const unstableFeatures = response["unstable_features"]; - if (unstableFeatures["m.id_access_token"] === undefined) { - return false; - } - return unstableFeatures["m.id_access_token"]; + return (versions && versions.includes("r0.6.0")) + || (unstableFeatures && unstableFeatures["m.id_access_token"]); }; /*