Skip to content

Commit fdfa26b

Browse files
committed
Clarify what is returned by the API.
1 parent 59e1369 commit fdfa26b

File tree

1 file changed

+32
-18
lines changed

1 file changed

+32
-18
lines changed

proposals/3856-threads-list-api.md

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,40 @@ paginate through all of the threads in the room, inspect the latest event from
2222
the bundled aggregations and attempt to sort them. This can require many round
2323
trips to the server and is wasteful for both the client and server.
2424

25-
Additionally, even with all of the threads a client is not able to accurately
26-
sort the threads since they lack the proper topological ordering of events. (The
27-
closest they can get is by using `age` or `origin_server_ts`, but this is not
28-
correct.)
29-
30-
For the second problem, it is currently not possible for a client to query for
31-
threads that the user has participated in (as defined in
32-
[MSC3440](https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3440-threading-via-relations.md#event-format)).
33-
A client could add the user's MXID to the filter, e.g. `"related_by_senders":["@alice:example.com"]`,
34-
but this misses threads where the user sent the root message and has not yet replied.
25+
Unfortunately even when a client has all the threads in a room is not able to accurately
26+
sort the threads since the client lacks the proper topological ordering of events. (The
27+
closest available information is the `age` or `origin_server_ts` of the events, but this
28+
is not always correct.)
29+
30+
Additionally, it is currently not possible for a client to query for threads that
31+
the user has participated in, as defined in
32+
[MSC3440](https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3440-threading-via-relations.md#event-format):
33+
34+
> The user has participated if:
35+
>
36+
> * They created the current event.
37+
> * They created an event with a m.thread relation targeting the current event.
38+
39+
Currently, clients add the requesting user's MXID to the `related_by_senders` filter
40+
(as defined in
41+
[MSC3440](https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3440-threading-via-relations.md#fetch-all-threads-in-a-room)),
42+
e.g. `"related_by_senders":["@alice:example.com"]`, but this results in missing
43+
threads where the user sent the root message and has not yet replied.
3544

3645
## Proposal
3746

3847
### Client-Server endpoint
3948

4049
A new endpoint is proposed to query for threads in a room. This endpoint requires
41-
authentication and is subject to rate-limiting. This endpoint includes
50+
authentication and is subject to rate-limiting.
51+
52+
The endpoint returns events, which represent thread roots and includes
4253
[bundled aggregations](https://spec.matrix.org/v1.3/client-server-api/#aggregations)
43-
in the response.
54+
in the response (which includes the "latest event" of each thread, see
55+
[MSC3440](https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3440-threading-via-relations.md#event-format)
56+
for the format of bundled aggregations of threads).
4457

45-
The returned threads are ordered by the most recently updated thread.
58+
The returned events are ordered by the latest event of each thread.
4659

4760
#### Request format
4861

@@ -54,9 +67,10 @@ Query Parameters:
5467

5568
* **`include`**: `enum`
5669

57-
Whether to include all threads in the room or only threads which the user has
58-
participated in, meaning that the user has created the root event of the thread
59-
or have created an event with a `m.thread` relation targeting the root.
70+
Whether to include all thread roots in the room or only thread roots which the
71+
user has participated in, meaning that the user has created the root event of
72+
the thread or replied to the thread (they have created an event with a `m.thread`
73+
relation targeting the root event).
6074

6175
One of `[all participated]`. Defaults to `all`.
6276
* **`from`**: `string`
@@ -65,8 +79,8 @@ Query Parameters:
6579
`prev_batch` or `next_batch` token returned by the `/sync` endpoint, or from
6680
an `end` token returned by a previous request to this endpoint.
6781

68-
If it is not provided, the homeserver shall return a list of threads from the
69-
last visible event in the room history for the requesting user.
82+
If it is not provided, the homeserver shall return a list of thread roots starting
83+
from the last visible event in the room history for the requesting user.
7084
* **`limit`**: Optional: a client-defined limit to the maximum
7185
number of threads to return per page. Must be an integer greater than zero.
7286

0 commit comments

Comments
 (0)