From 62d77231afd4ec404621ac09557570d2dcff8d6b Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 9 May 2022 16:11:04 -0600 Subject: [PATCH] Remove spec v1.3 check for threads (#2354) * Remove spec v1.3 check for threads Citation: https://matrix.to/#/!ewdjhNcPcEmYNKzlWp:t2l.io/$CkPuvKdFZyFL547JCy5J3MfvLaWUo_a1XEdmiop1PKc?via=matrix.org&via=element.io&via=envs.net * Enable stable support always for threads * Fix tests differently --- spec/unit/matrix-client.spec.ts | 7 ++++++- src/client.ts | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/spec/unit/matrix-client.spec.ts b/spec/unit/matrix-client.spec.ts index 24f9d55e3..d1562d766 100644 --- a/spec/unit/matrix-client.spec.ts +++ b/spec/unit/matrix-client.spec.ts @@ -91,7 +91,12 @@ describe("MatrixClient", function() { let pendingLookup = null; function httpReq(cb, method, path, qp, data, prefix) { if (path === KEEP_ALIVE_PATH && acceptKeepalives) { - return Promise.resolve(); + return Promise.resolve({ + unstable_features: { + "org.matrix.msc3440.stable": true, + }, + versions: ["r0.6.0", "r0.6.1"], + }); } const next = httpLookups.shift(); const logLine = ( diff --git a/src/client.ts b/src/client.ts index a705f5df5..ecec0ead1 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1171,6 +1171,8 @@ export class MatrixClient extends TypedEventEmitter { try { const hasUnstableSupport = await this.doesServerSupportUnstableFeature("org.matrix.msc3440"); - const hasStableSupport = await this.doesServerSupportUnstableFeature("org.matrix.msc3440.stable") - || await this.isVersionSupported("v1.3"); + const hasStableSupport = await this.doesServerSupportUnstableFeature("org.matrix.msc3440.stable"); + + // TODO: Use `this.isVersionSupported("v1.3")` for whatever spec version includes MSC3440 formally. return { serverSupport: hasUnstableSupport || hasStableSupport, stable: hasStableSupport, }; } catch (e) { + // Assume server support and stability aren't available: null/no data return. + // XXX: This should just return an object with `false` booleans instead. return null; } }