-
Notifications
You must be signed in to change notification settings - Fork 433
MSC4319: Room member events for invite and knock rooms in the /sync response
#4319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zecakeh
wants to merge
12
commits into
matrix-org:main
Choose a base branch
from
zecakeh:non-stripped-room-member-in-stripped-state
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+204
−0
Open
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bbf271f
Write proposal
zecakeh 3a07bc6
Add MSC number
zecakeh a4530d1
Fix filename
zecakeh 01c8ee4
Change stripped state format instead of mixing formats
zecakeh 1b81df4
Use full event format and move to state object
zecakeh f497f19
Fix typos
zecakeh 98a7a3e
Change MSC title
zecakeh 3bb2ab3
Add time limit to compatibility behavior
zecakeh e279119
Apply suggestion
zecakeh 3fb1fc9
Clarify that the stripped state change is for both CS and SS APIs
zecakeh ad5aa1f
Clarify purpose of the MSC
zecakeh 0c0d731
Add clarifications
zecakeh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # MSC4139: Room member events in stripped state | ||
|
|
||
| In the Client-Server API, the response of the [`GET /sync`](https://spec.matrix.org/v1.15/client-server-api/#get_matrixclientv3sync) | ||
| endpoint, the `events` array in the `invite_state` for rooms under `invite` and in the `knock_state` | ||
| for rooms under `knock` are defined as containing the stripped state of the room. | ||
|
|
||
| This stripped state comes over federation, via the | ||
| [`PUT /invite`](https://spec.matrix.org/v1.15/server-server-api/#put_matrixfederationv2inviteroomideventid) | ||
| and [`PUT /send_knock`](https://spec.matrix.org/v1.15/server-server-api/#put_matrixfederationv1send_knockroomideventid) | ||
| endpoints in the Server-Server API. | ||
|
|
||
| In the definition of the [stripped state](https://spec.matrix.org/v1.15/client-server-api/#stripped-state) | ||
| it is recommended to contain the following state events: | ||
|
|
||
| - `m.room.create` | ||
| - `m.room.name` | ||
| - `m.room.avatar` | ||
| - `m.room.topic` | ||
| - `m.room.join_rules` | ||
| - `m.room.canonical_alias` | ||
| - `m.room.encryption` | ||
|
|
||
| Although these events are useful to be able to present information about the room, they don't | ||
| contain information about the event itself. | ||
zecakeh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
zecakeh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The following information can be useful for clients: | ||
|
|
||
| - The sender of the invite, including their display name and avatar, to present to the user. | ||
| - The time of the invite or knock, to present to the user. | ||
| - Whether an invite event was preceded by a knock, if the client wants to auto-accept invites that | ||
| come from knocking. | ||
|
|
||
| _Note that part of this proposed change specifies behavior that has been implemented for a long time | ||
| in homeserver implementations and that clients already rely on._ | ||
|
|
||
|
|
||
| ## Proposal | ||
|
|
||
| For clients to be able to get details about an invite or knock, the `m.room.member` event that was | ||
| created during the invite or knock process MUST be present in the `events` of the `invite_state` or | ||
| `knock_state`. Making it mandatory makes sense because this event is the reason why the room appears | ||
| in `invite` or `knock` in the first place. | ||
|
|
||
| _Note that the example for the response of `GET /sync` already include the stripped `m.room.member` | ||
| event although it is not specified._ | ||
|
|
||
| The stripped state event format is modified in the Client-Server and Server-Server APIs to include | ||
| the optional `origin_server_ts`. This property is optional for backwards-compatibility but servers | ||
| MUST include the `origin_server_ts` if they have it. It means that in the `/sync` response, stripped | ||
| state received over federation might lack this field if the other server didn't send it, but the | ||
| `m.room.member` event should always have it, since the server always has this event as a PDU. | ||
|
|
||
| In the Client-Server API, the optional `unsigned` property is also added, identical to the one in | ||
| other event formats. This property is mostly expected for the `m.room.member` event, for clients to | ||
| be able to follow the transitions between membership states by looking at `prev_content`. | ||
|
|
||
| Example of an `m.room.member` in `invite_state`: | ||
|
|
||
| ```json | ||
| { | ||
| "content": { | ||
| "membership": "invite", | ||
| "displayname": "Alice" | ||
| }, | ||
| "type": "m.room.member", | ||
| "state_key": "@alice:example.org", | ||
| "sender": "@bob:example.org", | ||
| "origin_server_ts": 1432735824653, | ||
| "unsigned": { | ||
| "prev_content": { | ||
| "membership": "knock", | ||
| "displayname": "Alice" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Finally, the list of events that should be included in the stripped state is extended with the | ||
| stripped `m.room.member` event of the `sender` of the invite. This allows clients to be able to | ||
| display information about the sender of an invite, like their display name or avatar. | ||
|
|
||
|
|
||
| ## Potential issues | ||
|
|
||
| By showing more information about the sender of an invite, users might be subject to undesirable | ||
| content like abusive language or images. Mitigating this is out of scope of this MSC, and other MSCs | ||
| exist for this, like [MSC4278](https://github.com/matrix-org/matrix-spec-proposals/pull/4278). | ||
|
|
||
|
|
||
| ## Alternatives | ||
|
|
||
| We could put the full `m.room.member` event in the `invite_state` or `knock_state`, but mixing event | ||
| formats in a list is undesirable. | ||
|
|
||
| We could also put the full `m.room.member` event someplace else, like in a `state` property similar | ||
| to rooms under `join` or `leave`. It would have the added benefit that homeservers wouldn't need to | ||
| edit the stripped state that was received over federation. However this change would not be | ||
| compatible with the current ecosystem where clients already depend on all events being in the | ||
| `invite_state` or `knock_state`. | ||
|
|
||
|
|
||
| ## Security considerations | ||
|
|
||
| No potential security issues are known to the author. | ||
|
|
||
|
|
||
| ## Unstable prefix | ||
|
|
||
| None necessary, this is adding existing event types into existing arrays. | ||
|
|
||
|
|
||
| ## Dependencies | ||
|
|
||
| None. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.