1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00

Stabilise MSC4156 (#4381)

* Stabilise MSC4156

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>

* Add deprecation comments

* Add minimum Matrix version

---------

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
This commit is contained in:
Johannes Marbach
2024-09-04 14:01:33 +02:00
committed by GitHub
parent f50aab37c3
commit 52f35409ec
2 changed files with 4 additions and 12 deletions

View File

@@ -4292,13 +4292,11 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
signPromise = this.http.requestOtherUrl<IThirdPartySigned>(Method.Post, url); signPromise = this.http.requestOtherUrl<IThirdPartySigned>(Method.Post, url);
} }
let queryParams: QueryDict = {}; const queryParams: QueryDict = {};
if (opts.viaServers) { if (opts.viaServers) {
// server_name has been deprecated in favour of via with Matrix >1.11 (MSC4156)
queryParams.server_name = opts.viaServers; queryParams.server_name = opts.viaServers;
queryParams.via = opts.viaServers; queryParams.via = opts.viaServers;
if (this.canSupport.get(Feature.MigrateServerNameToVia) === ServerSupport.Unstable) {
queryParams = replaceParam("via", "org.matrix.msc4156.via", queryParams);
}
} }
const data: IJoinRequestBody = {}; const data: IJoinRequestBody = {};
@@ -4341,13 +4339,11 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
const path = utils.encodeUri("/knock/$roomIdOrAlias", { $roomIdOrAlias: roomIdOrAlias }); const path = utils.encodeUri("/knock/$roomIdOrAlias", { $roomIdOrAlias: roomIdOrAlias });
let queryParams: QueryDict = {}; const queryParams: QueryDict = {};
if (opts.viaServers) { if (opts.viaServers) {
// server_name has been deprecated in favour of via with Matrix >1.11 (MSC4156)
queryParams.server_name = opts.viaServers; queryParams.server_name = opts.viaServers;
queryParams.via = opts.viaServers; queryParams.via = opts.viaServers;
if (this.canSupport.get(Feature.MigrateServerNameToVia) === ServerSupport.Unstable) {
queryParams = replaceParam("via", "org.matrix.msc4156.via", queryParams);
}
} }
const body: Record<string, string> = {}; const body: Record<string, string> = {};

View File

@@ -33,7 +33,6 @@ export enum Feature {
AccountDataDeletion = "AccountDataDeletion", AccountDataDeletion = "AccountDataDeletion",
RelationsRecursion = "RelationsRecursion", RelationsRecursion = "RelationsRecursion",
IntentionalMentions = "IntentionalMentions", IntentionalMentions = "IntentionalMentions",
MigrateServerNameToVia = "MigrateServerNameToVia",
} }
type FeatureSupportCondition = { type FeatureSupportCondition = {
@@ -66,9 +65,6 @@ const featureSupportResolver: Record<string, FeatureSupportCondition> = {
unstablePrefixes: ["org.matrix.msc3952_intentional_mentions"], unstablePrefixes: ["org.matrix.msc3952_intentional_mentions"],
matrixVersion: "v1.7", matrixVersion: "v1.7",
}, },
[Feature.MigrateServerNameToVia]: {
unstablePrefixes: ["org.matrix.msc4156"],
},
}; };
export async function buildFeatureSupportMap(versions: IServerVersions): Promise<Map<Feature, ServerSupport>> { export async function buildFeatureSupportMap(versions: IServerVersions): Promise<Map<Feature, ServerSupport>> {