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

Stabilise extended profiles (now part of Matrix v1.16) (#5013)

* Stabilise extended profiles (v1.16)

* lint

* Add capacity

* Update profile keys

* copyright

* lint
This commit is contained in:
Will Hunt
2025-10-06 16:10:15 +01:00
committed by GitHub
parent d1d9aba745
commit e885ecf08d
3 changed files with 34 additions and 1 deletions

View File

@@ -6980,6 +6980,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
*/
public async doesServerSupportExtendedProfiles(): Promise<boolean> {
return (
(await this.isVersionSupported("v1.16")) ||
(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4133_EXTENDED_PROFILES)) ||
(await this.doesServerSupportUnstableFeature(STABLE_MSC4133_EXTENDED_PROFILES))
);
@@ -6991,7 +6992,10 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
* @returns The prefix for use with `authedRequest`
*/
private async getExtendedProfileRequestPrefix(): Promise<string> {
if (await this.doesServerSupportUnstableFeature("uk.tcpip.msc4133.stable")) {
if (
(await this.isVersionSupported("v1.16")) ||
(await this.doesServerSupportUnstableFeature("uk.tcpip.msc4133.stable"))
) {
return ClientPrefix.V3;
}
return "/_matrix/client/unstable/uk.tcpip.msc4133";

View File

@@ -1,8 +1,33 @@
/*
Copyright 2025 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* The timezone the user is currently in. The value of this property should
* match a timezone provided in https://www.iana.org/time-zones.
*
* This key was introduced in Matrix v1.16.
*/
export const ProfileKeyTimezone = "m.tz";
/**
* The timezone the user is currently in. The value of this property should
* match a timezone provided in https://www.iana.org/time-zones.
*
* @see https://github.com/matrix-org/matrix-spec-proposals/blob/clokep/profile-tz/proposals/4175-profile-field-time-zone.md
* @experimental
* @deprecated Unstable MSC field - Use `ProfileKeyTimezone`
*/
export const ProfileKeyMSC4175Timezone = "us.cloke.msc4175.tz";

View File

@@ -64,6 +64,10 @@ export interface Capabilities {
"m.set_displayname"?: ISetDisplayNameCapability;
"m.set_avatar_url"?: ISetAvatarUrlCapability;
"uk.tcpip.msc4133.profile_fields"?: IProfileFieldsCapability;
/**
* Since Matrix v1.16
*/
"m.profile_fields"?: IProfileFieldsCapability;
}
type CapabilitiesResponse = {