From 0697c82d4141ce2c522c7a7cf76cff21909658b9 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 7 Jun 2024 11:51:28 +0100 Subject: [PATCH 1/5] Spec `unsigned.membership` property, per MSC4115 --- .../client_server/newsfragments/1847.feature | 1 + .../client_event_without_room_id.yaml | 18 ++++++++++++++++++ .../examples/core/room_event.json | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 changelogs/client_server/newsfragments/1847.feature diff --git a/changelogs/client_server/newsfragments/1847.feature b/changelogs/client_server/newsfragments/1847.feature new file mode 100644 index 000000000..25d1914b9 --- /dev/null +++ b/changelogs/client_server/newsfragments/1847.feature @@ -0,0 +1 @@ +Add the new `unsigned.membership` property to events served over the client-server API, as per [MSC4115](https://github.com/matrix-org/matrix-spec-proposals/pull/4115). diff --git a/data/api/client-server/definitions/client_event_without_room_id.yaml b/data/api/client-server/definitions/client_event_without_room_id.yaml index d78dcc684..c10610297 100644 --- a/data/api/client-server/definitions/client_event_without_room_id.yaml +++ b/data/api/client-server/definitions/client_event_without_room_id.yaml @@ -90,6 +90,7 @@ properties: "origin_server_ts": 1632491098485, "unsigned": { "age": 1257, + "membership": "leave" } } transaction_id: @@ -112,3 +113,20 @@ properties: this. title: EventContent type: object + membership: + description: | + The room membership of the user making the request, at the time of the event. + + This property is the value of the `membership` property of the + requesting user's [`m.room.member`](#mroommember) state at the point + of the event, including any changes caused by the event. If the user + had yet to join the room at the time of the event (i.e, they have no + `m.room.member` state), this property is set to `leave`. + + It is recommended that homeservers SHOULD populate this property + wherever practical, but they MAY omit it if necessary (for example, + if calculating the value is expensive, servers might choose to only + implement it in encrypted rooms). + type: string + example: join + x-addedInMatrixVersion: "1.11" diff --git a/data/event-schemas/examples/core/room_event.json b/data/event-schemas/examples/core/room_event.json index 521225cc0..9bd62e283 100644 --- a/data/event-schemas/examples/core/room_event.json +++ b/data/event-schemas/examples/core/room_event.json @@ -5,6 +5,7 @@ "sender": "@example:example.org", "origin_server_ts": 1432735824653, "unsigned": { - "age": 1234 + "age": 1234, + "membership": "join" } } From 31e575de0231614cb8979d0621420a3826b80f5c Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 7 Jun 2024 11:58:04 +0100 Subject: [PATCH 2/5] fix link --- .../definitions/client_event_without_room_id.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/data/api/client-server/definitions/client_event_without_room_id.yaml b/data/api/client-server/definitions/client_event_without_room_id.yaml index c10610297..b12420042 100644 --- a/data/api/client-server/definitions/client_event_without_room_id.yaml +++ b/data/api/client-server/definitions/client_event_without_room_id.yaml @@ -118,10 +118,11 @@ properties: The room membership of the user making the request, at the time of the event. This property is the value of the `membership` property of the - requesting user's [`m.room.member`](#mroommember) state at the point - of the event, including any changes caused by the event. If the user - had yet to join the room at the time of the event (i.e, they have no - `m.room.member` state), this property is set to `leave`. + requesting user's [`m.room.member`](/client-server-api#mroommember) + state at the point of the event, including any changes caused by the + event. If the user had yet to join the room at the time of the event + (i.e, they have no `m.room.member` state), this property is set to + `leave`. It is recommended that homeservers SHOULD populate this property wherever practical, but they MAY omit it if necessary (for example, From 1c6fd8e5d74df5f79001fd1ad95ae3e0e295a129 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 7 Jun 2024 12:09:28 +0100 Subject: [PATCH 3/5] Add note about AS API. --- .../definitions/client_event_without_room_id.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/api/client-server/definitions/client_event_without_room_id.yaml b/data/api/client-server/definitions/client_event_without_room_id.yaml index b12420042..b1eedda44 100644 --- a/data/api/client-server/definitions/client_event_without_room_id.yaml +++ b/data/api/client-server/definitions/client_event_without_room_id.yaml @@ -127,7 +127,8 @@ properties: It is recommended that homeservers SHOULD populate this property wherever practical, but they MAY omit it if necessary (for example, if calculating the value is expensive, servers might choose to only - implement it in encrypted rooms). + implement it in encrypted rooms). The property is *not* normally populated + in the application service API (where there is no clear definition of "requesting user"). type: string example: join x-addedInMatrixVersion: "1.11" From a0244f67e5d836634752720437fb9350ca651c3d Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Mon, 10 Jun 2024 10:32:47 +0100 Subject: [PATCH 4/5] Update data/api/client-server/definitions/client_event_without_room_id.yaml --- .../definitions/client_event_without_room_id.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/api/client-server/definitions/client_event_without_room_id.yaml b/data/api/client-server/definitions/client_event_without_room_id.yaml index b1eedda44..f3ff5424b 100644 --- a/data/api/client-server/definitions/client_event_without_room_id.yaml +++ b/data/api/client-server/definitions/client_event_without_room_id.yaml @@ -128,7 +128,8 @@ properties: wherever practical, but they MAY omit it if necessary (for example, if calculating the value is expensive, servers might choose to only implement it in encrypted rooms). The property is *not* normally populated - in the application service API (where there is no clear definition of "requesting user"). + in events pushed to application services via the application service transaction API + (where there is no clear definition of "requesting user"). type: string example: join x-addedInMatrixVersion: "1.11" From 5136a35c7862dcbe87e439fb2d401dd1f74fc88e Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Mon, 10 Jun 2024 13:16:11 +0100 Subject: [PATCH 5/5] Update data/api/client-server/definitions/client_event_without_room_id.yaml Co-authored-by: Johannes Marbach --- .../client-server/definitions/client_event_without_room_id.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/api/client-server/definitions/client_event_without_room_id.yaml b/data/api/client-server/definitions/client_event_without_room_id.yaml index f3ff5424b..b12611a21 100644 --- a/data/api/client-server/definitions/client_event_without_room_id.yaml +++ b/data/api/client-server/definitions/client_event_without_room_id.yaml @@ -124,7 +124,7 @@ properties: (i.e, they have no `m.room.member` state), this property is set to `leave`. - It is recommended that homeservers SHOULD populate this property + Homeservers SHOULD populate this property wherever practical, but they MAY omit it if necessary (for example, if calculating the value is expensive, servers might choose to only implement it in encrypted rooms). The property is *not* normally populated