Skip to content

Commit fea0b92

Browse files
authored
Add time zone profile field from MSC4175 (#2206)
1 parent bfbeb5e commit fea0b92

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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).
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).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a profile field for a user's time zone, per [MSC4175](https://github.com/matrix-org/matrix-spec-proposals/pull/4175).

data/api/client-server/profile.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ paths:
1919
"/profile/{userId}/{keyName}":
2020
put:
2121
x-changedInMatrixVersion:
22-
"1.16": This endpoint now accepts a variable `keyName` parameter. Previously only `displayname` and `avatar_url` were accepted.
22+
"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.
2323
summary: Set a profile field for a user.
2424
description: |-
2525
Set or update a profile field for a user. Must be authenticated with an
@@ -44,13 +44,13 @@ paths:
4444
- in: path
4545
name: keyName
4646
description: The name of the profile field to set. This MUST be either
47-
`avatar_url`, `displayname`, or a custom field following the
47+
`avatar_url`, `displayname`, `m.tz`, or a custom field following the
4848
[Common Namespaced Identifier Grammar](/appendices/#common-namespaced-identifier-grammar).
4949
required: true
5050
example: "displayname"
5151
schema:
5252
type: string
53-
pattern: '^(avatar_url|displayname|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$'
53+
pattern: '^(avatar_url|displayname|m\.tz|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$'
5454
requestBody:
5555
description: A JSON object containing the property whose name matches
5656
the `keyName` specified in the URL. See `additionalProperties` for
@@ -69,6 +69,10 @@ paths:
6969
7070
For `displayname`, the value MUST be a string.
7171
72+
For `m.tz`, the value MUST be a valid identifier from the [IANA Time Zone Database](https://www.iana.org/time-zones).
73+
Servers MAY choose to validate the value. Clients MUST expect unknown or invalid
74+
values.
75+
7276
For custom keys, any JSON type is allowed. Servers MAY not validate
7377
these values, but clients SHOULD follow the format defined for that key.
7478
additionalProperties: true
@@ -137,7 +141,7 @@ paths:
137141
- User data
138142
get:
139143
x-changedInMatrixVersion:
140-
"1.16": This endpoint now accepts a variable `keyName` parameter. Previously only `displayname` and `avatar_url` were accepted.
144+
"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.
141145
summary: Get a profile field for a user.
142146
description: Get the value of a profile field for a user.
143147
operationId: getProfileField
@@ -156,7 +160,7 @@ paths:
156160
example: "displayname"
157161
schema:
158162
type: string
159-
pattern: '^(avatar_url|displayname|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$'
163+
pattern: '^(avatar_url|displayname|m\.tz|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$'
160164
responses:
161165
"200":
162166
description: The profile field value was retrieved.
@@ -214,7 +218,7 @@ paths:
214218
example: "displayname"
215219
schema:
216220
type: string
217-
pattern: '^(avatar_url|displayname|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$'
221+
pattern: '^(avatar_url|displayname|m\.tz|[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+)$'
218222
responses:
219223
"200":
220224
description: The profile field was deleted or it doesn't exist.
@@ -293,6 +297,10 @@ paths:
293297
type: string
294298
description: The user's display name if they have set one, otherwise not
295299
present.
300+
m.tz:
301+
x-addedInMatrixVersion: "1.16"
302+
type: string
303+
description: The user's time zone.
296304
additionalProperties:
297305
x-addedInMatrixVersion: "1.16"
298306
description: Additional profile fields.
@@ -302,6 +310,7 @@ paths:
302310
{
303311
"avatar_url": "mxc://matrix.org/SDGdghriugerRg",
304312
"displayname": "Alice Margatroid",
313+
"m.tz": "Europe/London",
305314
"m.example_field": "custom_value",
306315
}
307316
"403":

0 commit comments

Comments
 (0)