Skip to content

Commit b94d379

Browse files
committed
Add federation and reword a bit.
1 parent b5d0969 commit b94d379

File tree

1 file changed

+59
-14
lines changed

1 file changed

+59
-14
lines changed

proposals/3173-expose-stripped-state-events.md

Lines changed: 59 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ recommends including the `m.room.create` event as one of the stripped state even
7979
This proposal includes a few aspects which are dealt with separately:
8080

8181
1. Generalizing when a user is allowed to view the stripped state of a room.
82-
2. A consistent recommendation for which events to include in the stripped state.
82+
2. A consistent definition of stripped state and a recommendation for which
83+
events to include in the stripped state.
8384
3. Providing a dedicated API for accessing the stripped state of the room.
8485

8586
### Accessing the stripped state of a room
@@ -102,12 +103,21 @@ should consider this MSC, for example:
102103
proposes allowing users to join a room based on their membership in a space (as defined in
103104
[MSC1772](https://github.com/matrix-org/matrix-doc/pull/1772)).
104105

105-
### Events to include in the stripped state
106+
### Stripped state definitions and recommended events
106107

107-
It is also proposed to create a single definition for what stripped state events
108-
should be provided to be potential joiners. Thus, it is recommended (although not
109-
required<sup id="a0">[0](#f0)</sup>) that homeserver implementations include the
110-
following as stripped state events:
108+
It is also proposed to create a single definition of what the stripped state of
109+
a room is and for what events should be included in the stripped state to be
110+
potential joiners.
111+
112+
The stripped state of a room is a list of simplified state events to help a
113+
potential joiner identify the room. These state events may only have the
114+
`sender`, `type`, `state_key` and `content` keys present. These events do not
115+
replace any state that the client already has for the room, for example if the
116+
client has archived the room.
117+
118+
It is recommended (although not required<sup id="a0">[0](#f0)</sup>) that
119+
homeserver implementations include the following events as part of the stripped
120+
state of a room:
111121

112122
* Create event (`m.room.create`)<sup id="a1">[1](#f1)</sup>
113123
* Join rules (`m.room.join_rules`)
@@ -119,7 +129,9 @@ following as stripped state events:
119129

120130
### Stripped state API
121131

122-
`GET /_matrix/client/r0/rooms/{roomId}/stripped_state`
132+
#### Client-server API
133+
134+
`GET /_matrix/client/r0/rooms/{roomIdOrAlias}/stripped_state`
123135

124136
A dedicated API is provided to query for the stripped state of a room. As
125137
described above, any potential joiner may access the stripped state of a room
@@ -128,19 +140,26 @@ may access the stripped state, as it is a strict subset of the state).
128140

129141
This API is rate-limited and does not require authentication.
130142

131-
The request format follows [the `/state`](https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-rooms-roomid-state)
132-
endpoint.
143+
The request format follows [the `/state` endpoint](https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-rooms-roomid-state),
144+
but with the addition of handling a `server_name` query parameter (as
145+
specified for [the `/join/{roomIdOrAlias}` endpoint](https://matrix.org/docs/spec/client_server/latest#post-matrix-client-r0-join-roomidoralias)).
133146

134147
The response body includes an array of `StrippedState`, as
135148
[described in the `/sync` response](https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-sync).
136149

137-
#### Example request:
150+
If the homeserver does not know the state of the requested room it should use
151+
the corresponding federation API to request the stripped state from another
152+
homeserver.
153+
154+
TODO
155+
156+
##### Example request:
138157

139158
`GET /_matrix/client/r0/rooms/%21636q39766251%3Aexample.com/stripped_state HTTP/1.1`
140159

141-
#### Responses:
160+
##### Responses:
142161

143-
##### Status code 200:
162+
###### Status code 200:
144163

145164
The current stripped state of the room
146165

@@ -174,10 +193,33 @@ The current stripped state of the room
174193
Note that this is the same example as [the `/state` endpoint](https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-rooms-roomid-state),
175194
but limited to what would be returned as stripped state.
176195

177-
##### Status code 403:
196+
###### Status code 403:
178197

179198
You are not a member of the room, a potential joiner, and the room is not publicly viewable.
180199

200+
#### Server-server API
201+
202+
`GET /_matrix/federation/v1/stripped_state/{roomId}`
203+
204+
Retrieve the stripped state of a room, this is essentially identical to the
205+
client-server API, but will not reach out over federation.
206+
207+
Path parameters:
208+
209+
* `roomId` - **Required.** The room ID to get state for.
210+
211+
Response format:
212+
213+
* `stripped_state` - `[StrippedState]` A list of simplified events to help identify the room.
214+
215+
The form of `StrippedState` is as defined in
216+
[the `/invite/{roomId}/{eventId}` endpoint](https://matrix.org/docs/spec/server_server/latest#put-matrix-federation-v2-invite-roomid-eventid).
217+
218+
The stripped state should be returned to the requesting server if the host has
219+
a potential joiner, e.g. if the room has `join_rules` set to `public` or any
220+
user on the request server is in possession of an invite to the room. The
221+
requesting server is responsible for filtering the returned data to the client.
222+
181223
## Potential issues
182224

183225
This is a generalization of current behavior and shouldn't introduce any new issues.
@@ -222,7 +264,10 @@ for potential joiners due to membership in a space.
222264

223265
## Unstable prefix
224266

225-
N/A
267+
| Stable Endpoint | Unstable Endpoint |
268+
|---|---|
269+
| `/_matrix/client/r0/rooms/{roomIdOrAlias}/stripped_state` | `/_matrix/client/unstable/org.matrix.msc3173/rooms/{roomIdOrAlias}/stripped_state` |
270+
| `/_matrix/federation/v1/stripped_state/{roomId}` | `/_matrix/federation/unstable/org.matrix.msc3173/stripped_state/{roomId}` |
226271

227272
## Footnotes
228273

0 commit comments

Comments
 (0)