@@ -22,27 +22,40 @@ paginate through all of the threads in the room, inspect the latest event from
22
22
the bundled aggregations and attempt to sort them. This can require many round
23
23
trips to the server and is wasteful for both the client and server.
24
24
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.
35
44
36
45
## Proposal
37
46
38
47
### Client-Server endpoint
39
48
40
49
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
42
53
[ 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).
44
57
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.
46
59
47
60
#### Request format
48
61
@@ -54,9 +67,10 @@ Query Parameters:
54
67
55
68
* ** ` include ` ** : ` enum `
56
69
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).
60
74
61
75
One of ` [all participated] ` . Defaults to ` all ` .
62
76
* ** ` from ` ** : ` string `
@@ -65,8 +79,8 @@ Query Parameters:
65
79
` prev_batch ` or ` next_batch ` token returned by the ` /sync ` endpoint, or from
66
80
an ` end ` token returned by a previous request to this endpoint.
67
81
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.
70
84
* ** ` limit ` ** : Optional: a client-defined limit to the maximum
71
85
number of threads to return per page. Must be an integer greater than zero.
72
86
0 commit comments