From fea0b925a00124d0c0da03f10bcc32f344047146 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Tue, 9 Sep 2025 12:02:39 -0400 Subject: [PATCH] Add time zone profile field from MSC4175 (#2206) --- .../client_server/newsfragments/2071.feature | 2 +- .../client_server/newsfragments/2206.feature | 1 + data/api/client-server/profile.yaml | 21 +++++++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 changelogs/client_server/newsfragments/2206.feature diff --git a/changelogs/client_server/newsfragments/2071.feature b/changelogs/client_server/newsfragments/2071.feature index 94b77218..96a2b0c4 100644 --- a/changelogs/client_server/newsfragments/2071.feature +++ b/changelogs/client_server/newsfragments/2071.feature @@ -1 +1 @@ -Update user profile endpoints to handle custom fields, and add a new `m.profile_fields` capability,as per [MSC4133](https://github.com/matrix-org/matrix-spec-proposals/pull/4133). +Update user profile endpoints to handle custom fields, and add a new `m.profile_fields` capability, as per [MSC4133](https://github.com/matrix-org/matrix-spec-proposals/pull/4133). diff --git a/changelogs/client_server/newsfragments/2206.feature b/changelogs/client_server/newsfragments/2206.feature new file mode 100644 index 00000000..b149ab6f --- /dev/null +++ b/changelogs/client_server/newsfragments/2206.feature @@ -0,0 +1 @@ +Add a profile field for a user's time zone, per [MSC4175](https://github.com/matrix-org/matrix-spec-proposals/pull/4175). diff --git a/data/api/client-server/profile.yaml b/data/api/client-server/profile.yaml index dbbc1950..9f872fe8 100644 --- a/data/api/client-server/profile.yaml +++ b/data/api/client-server/profile.yaml @@ -19,7 +19,7 @@ paths: "/profile/{userId}/{keyName}": put: x-changedInMatrixVersion: - "1.16": This endpoint now accepts a variable `keyName` parameter. Previously only `displayname` and `avatar_url` were accepted. + "1.16": This endpoint now accepts a variable `keyName` parameter and `m.tz` was added as a defined key. Previously only `displayname` and `avatar_url` were accepted. summary: Set a profile field for a user. description: |- Set or update a profile field for a user. Must be authenticated with an @@ -44,13 +44,13 @@ paths: - in: path name: keyName description: The name of the profile field to set. This MUST be either - `avatar_url`, `displayname`, or a custom field following the + `avatar_url`, `displayname`, `m.tz`, or a custom field following the [Common Namespaced Identifier Grammar](/appendices/#common-namespaced-identifier-grammar). required: true example: "displayname" schema: type: string - pattern: '^(avatar_url|displayname|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$' + pattern: '^(avatar_url|displayname|m\.tz|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$' requestBody: description: A JSON object containing the property whose name matches the `keyName` specified in the URL. See `additionalProperties` for @@ -69,6 +69,10 @@ paths: For `displayname`, the value MUST be a string. + For `m.tz`, the value MUST be a valid identifier from the [IANA Time Zone Database](https://www.iana.org/time-zones). + Servers MAY choose to validate the value. Clients MUST expect unknown or invalid + values. + For custom keys, any JSON type is allowed. Servers MAY not validate these values, but clients SHOULD follow the format defined for that key. additionalProperties: true @@ -137,7 +141,7 @@ paths: - User data get: x-changedInMatrixVersion: - "1.16": This endpoint now accepts a variable `keyName` parameter. Previously only `displayname` and `avatar_url` were accepted. + "1.16": This endpoint now accepts a variable `keyName` parameter and `m.tz` was added as a defined key. Previously only `displayname` and `avatar_url` were accepted. summary: Get a profile field for a user. description: Get the value of a profile field for a user. operationId: getProfileField @@ -156,7 +160,7 @@ paths: example: "displayname" schema: type: string - pattern: '^(avatar_url|displayname|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$' + pattern: '^(avatar_url|displayname|m\.tz|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$' responses: "200": description: The profile field value was retrieved. @@ -214,7 +218,7 @@ paths: example: "displayname" schema: type: string - pattern: '^(avatar_url|displayname|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$' + pattern: '^(avatar_url|displayname|m\.tz|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$' responses: "200": description: The profile field was deleted or it doesn't exist. @@ -293,6 +297,10 @@ paths: type: string description: The user's display name if they have set one, otherwise not present. + m.tz: + x-addedInMatrixVersion: "1.16" + type: string + description: The user's time zone. additionalProperties: x-addedInMatrixVersion: "1.16" description: Additional profile fields. @@ -302,6 +310,7 @@ paths: { "avatar_url": "mxc://matrix.org/SDGdghriugerRg", "displayname": "Alice Margatroid", + "m.tz": "Europe/London", "m.example_field": "custom_value", } "403":