From 80d1a20f254ded12f2e03df20a3fe2be6def8f08 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Thu, 22 Jan 2026 08:37:29 +0100 Subject: [PATCH 1/4] Spec for MSC4267: Automatically forgetting rooms on leave Signed-off-by: Johannes Marbach --- .../client_server/newsfragments/2292.feature | 1 + content/client-server-api/_index.md | 32 +++++++++++++++++++ data/api/client-server/capabilities.yaml | 5 +++ data/api/client-server/leaving.yaml | 11 +++++-- 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 changelogs/client_server/newsfragments/2292.feature diff --git a/changelogs/client_server/newsfragments/2292.feature b/changelogs/client_server/newsfragments/2292.feature new file mode 100644 index 00000000..6547782b --- /dev/null +++ b/changelogs/client_server/newsfragments/2292.feature @@ -0,0 +1 @@ +Add `m.forget_forced_upon_leave` capability for servers to transparently auto-forget rooms that the user leaves as per [MSC4267](https://github.com/matrix-org/matrix-spec-proposals/pull/4267). diff --git a/content/client-server-api/_index.md b/content/client-server-api/_index.md index 6f680fde..c62938df 100644 --- a/content/client-server-api/_index.md +++ b/content/client-server-api/_index.md @@ -2619,6 +2619,38 @@ An example of the capability API's response for this capability is: } ``` +### `m.forget_forced_upon_leave` capability + +This capability has a single flag, `enabled`, which indicates whether or +not the server automatically forgets rooms which the user has left. + +When `enabled` is `true` and the user leaves a room, the server will automatically +forget the room – just as if the user had called [`/forget`](#post_matrixclientv3roomsroomidforget) +themselves. This behavior applies irrespective of whether the user has left the +room on their own (through [`/leave`](#post_matrixclientv3roomsroomidleave)) or +has been kicked or banned from the room by another user. + +When `enabled` is `false`, the server does not automatically forget rooms +upon leave. In this case, clients MAY distinguish the actions of leaving +and forgetting a room in their UI. Similarly, clients MAY retrieve and +visualize left but unforgotten rooms using a [filter](#filtering) with +`include_leave = true`. + +When the capability or the `enabled` property are not present, clients SHOULD +assume that the server does not automatically forget rooms. + +An example of the capability API's response for this capability is: + +```json +{ + "capabilities": { + "m.forget_forced_upon_leave": { + "enabled": true + } + } +} +``` + ### `m.room_versions` capability This capability describes the default and available room versions a diff --git a/data/api/client-server/capabilities.yaml b/data/api/client-server/capabilities.yaml index 2e8c8849..df86c2da 100644 --- a/data/api/client-server/capabilities.yaml +++ b/data/api/client-server/capabilities.yaml @@ -50,6 +50,11 @@ paths: m.change_password: $ref: '#/components/schemas/booleanCapability' description: Capability to indicate if the user can change their password. + m.forget_forced_upon_leave: + $ref: '#/components/schemas/booleanCapability' + description: |- + Capability to indicate if the server automatically forgets rooms once the user + leaves. m.room_versions: type: object description: The room versions the server supports. diff --git a/data/api/client-server/leaving.yaml b/data/api/client-server/leaving.yaml index 6bdadb08..db61818f 100644 --- a/data/api/client-server/leaving.yaml +++ b/data/api/client-server/leaving.yaml @@ -29,8 +29,15 @@ paths: If the user was invited to the room, but had not joined, this call serves to reject the invite. - The user will still be allowed to retrieve history from the room which - they were previously allowed to see. + Servers MAY additionally forget the room when this endpoint is called – + just as if the user had also invoked [`/forget`](/client-server-api/#post_matrixclientv3roomsroomidforget). + Servers that do this, MUST inform clients about this behavior using the + [`m.forget_forced_upon_leave`](/client-server-api/#mforget_forced_upon_leave-capability) + capability. + + If the server doesn't automatically forget the room, the user will still be + allowed to retrieve history from the room which they were previously allowed + to see. operationId: leaveRoom security: - accessTokenQuery: [] From fe20bb6c5a267d76c79db1dadfcb416e4eeb9fc9 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Fri, 23 Jan 2026 08:15:46 +0100 Subject: [PATCH 2/4] Add missing version annotations Signed-off-by: Johannes Marbach --- content/client-server-api/_index.md | 2 ++ data/api/client-server/capabilities.yaml | 1 + data/api/client-server/leaving.yaml | 19 +++++++++---------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/content/client-server-api/_index.md b/content/client-server-api/_index.md index c62938df..7cff2807 100644 --- a/content/client-server-api/_index.md +++ b/content/client-server-api/_index.md @@ -2621,6 +2621,8 @@ An example of the capability API's response for this capability is: ### `m.forget_forced_upon_leave` capability +{{% added-in v="1.18" %}} + This capability has a single flag, `enabled`, which indicates whether or not the server automatically forgets rooms which the user has left. diff --git a/data/api/client-server/capabilities.yaml b/data/api/client-server/capabilities.yaml index df86c2da..f73e8b46 100644 --- a/data/api/client-server/capabilities.yaml +++ b/data/api/client-server/capabilities.yaml @@ -51,6 +51,7 @@ paths: $ref: '#/components/schemas/booleanCapability' description: Capability to indicate if the user can change their password. m.forget_forced_upon_leave: + x-addedInMatrixVersion: "1.18" $ref: '#/components/schemas/booleanCapability' description: |- Capability to indicate if the server automatically forgets rooms once the user diff --git a/data/api/client-server/leaving.yaml b/data/api/client-server/leaving.yaml index db61818f..424079d5 100644 --- a/data/api/client-server/leaving.yaml +++ b/data/api/client-server/leaving.yaml @@ -28,16 +28,15 @@ paths: If the user was invited to the room, but had not joined, this call serves to reject the invite. - - Servers MAY additionally forget the room when this endpoint is called – - just as if the user had also invoked [`/forget`](/client-server-api/#post_matrixclientv3roomsroomidforget). - Servers that do this, MUST inform clients about this behavior using the - [`m.forget_forced_upon_leave`](/client-server-api/#mforget_forced_upon_leave-capability) - capability. - - If the server doesn't automatically forget the room, the user will still be - allowed to retrieve history from the room which they were previously allowed - to see. + x-changedInMatrixVersion: + "1.18": | + Servers MAY additionally forget the room when this endpoint is called – + just as if the user had also invoked [`/forget`](/client-server-api/#post_matrixclientv3roomsroomidforget). + Servers that do this, MUST inform clients about this behavior using the + [`m.forget_forced_upon_leave`](/client-server-api/#mforget_forced_upon_leave-capability) + capability. If the server doesn't automatically forget the room, the user + will still be allowed to retrieve history from the room which they were + previously allowed to see. operationId: leaveRoom security: - accessTokenQuery: [] From aeb87446be02cbc3224a7be3e6b75af30238840b Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Mon, 26 Jan 2026 10:51:09 +0100 Subject: [PATCH 3/4] Revert "Add missing version annotations" This reverts commit fe20bb6c5a267d76c79db1dadfcb416e4eeb9fc9. --- content/client-server-api/_index.md | 2 -- data/api/client-server/capabilities.yaml | 1 - data/api/client-server/leaving.yaml | 19 ++++++++++--------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/content/client-server-api/_index.md b/content/client-server-api/_index.md index 7cff2807..c62938df 100644 --- a/content/client-server-api/_index.md +++ b/content/client-server-api/_index.md @@ -2621,8 +2621,6 @@ An example of the capability API's response for this capability is: ### `m.forget_forced_upon_leave` capability -{{% added-in v="1.18" %}} - This capability has a single flag, `enabled`, which indicates whether or not the server automatically forgets rooms which the user has left. diff --git a/data/api/client-server/capabilities.yaml b/data/api/client-server/capabilities.yaml index f73e8b46..df86c2da 100644 --- a/data/api/client-server/capabilities.yaml +++ b/data/api/client-server/capabilities.yaml @@ -51,7 +51,6 @@ paths: $ref: '#/components/schemas/booleanCapability' description: Capability to indicate if the user can change their password. m.forget_forced_upon_leave: - x-addedInMatrixVersion: "1.18" $ref: '#/components/schemas/booleanCapability' description: |- Capability to indicate if the server automatically forgets rooms once the user diff --git a/data/api/client-server/leaving.yaml b/data/api/client-server/leaving.yaml index 424079d5..db61818f 100644 --- a/data/api/client-server/leaving.yaml +++ b/data/api/client-server/leaving.yaml @@ -28,15 +28,16 @@ paths: If the user was invited to the room, but had not joined, this call serves to reject the invite. - x-changedInMatrixVersion: - "1.18": | - Servers MAY additionally forget the room when this endpoint is called – - just as if the user had also invoked [`/forget`](/client-server-api/#post_matrixclientv3roomsroomidforget). - Servers that do this, MUST inform clients about this behavior using the - [`m.forget_forced_upon_leave`](/client-server-api/#mforget_forced_upon_leave-capability) - capability. If the server doesn't automatically forget the room, the user - will still be allowed to retrieve history from the room which they were - previously allowed to see. + + Servers MAY additionally forget the room when this endpoint is called – + just as if the user had also invoked [`/forget`](/client-server-api/#post_matrixclientv3roomsroomidforget). + Servers that do this, MUST inform clients about this behavior using the + [`m.forget_forced_upon_leave`](/client-server-api/#mforget_forced_upon_leave-capability) + capability. + + If the server doesn't automatically forget the room, the user will still be + allowed to retrieve history from the room which they were previously allowed + to see. operationId: leaveRoom security: - accessTokenQuery: [] From cb31a6828b662c3cdcb06c39c3cc7946a8c82bf9 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Mon, 26 Jan 2026 10:53:26 +0100 Subject: [PATCH 4/4] Rearrange description of /leave Signed-off-by: Johannes Marbach --- data/api/client-server/leaving.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/api/client-server/leaving.yaml b/data/api/client-server/leaving.yaml index db61818f..edb8ffd3 100644 --- a/data/api/client-server/leaving.yaml +++ b/data/api/client-server/leaving.yaml @@ -19,6 +19,10 @@ paths: "/rooms/{roomId}/leave": post: summary: Stop the requesting user participating in a particular room. + x-changedInMatrixVersion: + "1.18": |- + Servers may additionally forget the room provided that they make this behavior + transparent. description: |- This API stops a user participating in a particular room.