Various clarifications based on feedback.

kegan/spaces-summary
Patrick Cloke 5 years ago
parent 9c2e85a5da
commit 760cda8073

@ -33,6 +33,9 @@ An endpoint is provided to walk the space tree, starting at the provided room ID
("the root room"), and visiting other rooms/spaces found via `m.space.child` ("the root room"), and visiting other rooms/spaces found via `m.space.child`
events. It recurses into the children and into their children, etc. events. It recurses into the children and into their children, etc.
Note that there is no requirement for any of the rooms to be of have a `type` of
`m.space`, any room with `m.space.child` events is considered.
Example request: Example request:
```jsonc ```jsonc
@ -117,27 +120,35 @@ Response fields:
following fields are returned: `type`, `state_key`, `content`, `room_id`, following fields are returned: `type`, `state_key`, `content`, `room_id`,
`sender`. `sender`.
Errors:
403 with an error code of `M_FORBIDDEN`: if the user doesn't have permission to
view/peek the root room (including if that room does not exist).
#### Algorithm #### Algorithm
A rough algorithm follows:
1. Start at the "root" room (the provided room ID). 1. Start at the "root" room (the provided room ID).
2. Generate a summary and add it to `rooms`. 2. Generate a summary and add it to `rooms`.
3. Add any `m.space.child` events in the room to `events`. 3. Add any `m.space.child` events in the room to `events`.
4. Recurse into the targets of the `m.space.child` events, generate a summary for 4. Recurse into the targets of the `m.space.child` events.
each room and add it to `rooms`, also add any `m.space.child` events of the room 1. If the room is not accessible (or has already been processed), do not
to `events`. process it.
5. Recurse into grandchildren, etc. until either all discovered rooms have been 2. Generate a summary for the room and add it to `rooms`.
inspected, or the server-side limit on the number of rooms is reached. 3. Add any `m.space.child` events of the room to `events`.
5. Recurse into any newly added targets of `m.space.child` events (i.e. repeat
step 4), until either all discovered rooms have been inspected, or the
server-side limit on the number of rooms is reached.
Other notes: Other notes:
* If the user doesn't have permission to view/peek the root room (including if * Any inaccessible children are omitted from the result, but the `m.space.child`
that room does not exist), a 403 error is returned with `M_FORBIDDEN`. Any events that point to them are still returned.
inaccessible children are simply omitted from the result (though the `m.space.child`
events that point to them are still returned).
* There could be loops in the returned child events - clients should handle this * There could be loops in the returned child events - clients should handle this
gracefully. gracefully.
* Similarly, note that a child room might appear multiple times (e.g. also be a * Similarly, note that a child room might appear multiple times (e.g. also be a
grandchild). grandchild). Clients and servers should handle this appropriately.
* `suggested_only` applies transitively. * `suggested_only` applies transitively.
For example, if a space A has child space B which is *not* suggested, and space For example, if a space A has child space B which is *not* suggested, and space

Loading…
Cancel
Save