Disable ICE fallback based on well-known configuration (#111)

* Refactor MatrixClientBackedController.ts

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Disable ICE fallback based on well-known configuration

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2024-10-02 15:08:15 +01:00
committed by GitHub
parent 8a263ac1b0
commit 9895a8fb4f
7 changed files with 119 additions and 15 deletions
@@ -6,8 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
Please see LICENSE files in the repository root for full details.
*/
import { MatrixClient } from "matrix-js-sdk/src/matrix";
import { SettingLevel } from "../SettingLevel";
import MatrixClientBackedController from "./MatrixClientBackedController";
import { WatchManager } from "../WatchManager";
@@ -53,9 +51,9 @@ export default class ServerSupportUnstableFeatureController extends MatrixClient
this.watchers.notifyUpdate(this.settingName, null, level, settingValue);
}
protected async initMatrixClient(oldClient: MatrixClient, newClient: MatrixClient): Promise<void> {
protected async initMatrixClient(): Promise<void> {
// Check for stable version support first
if (this.stableVersion && (await this.client.isVersionSupported(this.stableVersion))) {
if (this.stableVersion && (await this.client!.isVersionSupported(this.stableVersion))) {
this.disabled = false;
return;
}
@@ -66,7 +64,7 @@ export default class ServerSupportUnstableFeatureController extends MatrixClient
for (const featureGroup of this.unstableFeatureGroups) {
const featureSupportList = await Promise.all(
featureGroup.map(async (feature) => {
const isFeatureSupported = await this.client.doesServerSupportUnstableFeature(feature);
const isFeatureSupported = await this.client!.doesServerSupportUnstableFeature(feature);
return isFeatureSupported;
}),
);