mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-03-27 13:34:09 +01:00
Apply suggestions from code review
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
parent
42e5c4d4fc
commit
f8d667a2ad
|
|
@ -1846,18 +1846,18 @@ the topic to be removed from the room.
|
||||||
{{% changed-in v="1.3" %}}
|
{{% changed-in v="1.3" %}}
|
||||||
|
|
||||||
In some cases it is desirable to logically associate one event's contents with
|
In some cases it is desirable to logically associate one event's contents with
|
||||||
another event's contents. For example, when replying to a message, editing an
|
another event's contents — for example, when replying to a message, editing an
|
||||||
event, or simply looking to add context for an event's purpose.
|
event, or simply looking to add context for an event's purpose.
|
||||||
|
|
||||||
Events are related to each other in a parent/child structure, where any event can
|
Events are related to each other in a parent/child structure, where any event can
|
||||||
become a parent by simply having a child event point at it. Parent events do not
|
become a parent by simply having a child event point at it. Parent events do not
|
||||||
define their children, instead relying on the children to describe their parent.
|
define their children, instead relying on the children to describe their parent.
|
||||||
|
|
||||||
The relationship between a child and it's parent event is described in the child
|
The relationship between a child and its parent event is described in the child
|
||||||
event's `content` as `m.relates_to` (defined below). A child event can point at
|
event's `content` as `m.relates_to` (defined below). A child event can point at
|
||||||
any other event, including another child event, to build the relationship so long
|
any other event, including another child event, to build the relationship so long
|
||||||
as both events are in the same room, however additional restrictions might be imposed
|
as both events are in the same room, however additional restrictions might be imposed
|
||||||
by the `rel_type` itself.
|
by the type of the relationship (the `rel_type`).
|
||||||
|
|
||||||
{{% boxes/note %}}
|
{{% boxes/note %}}
|
||||||
Child events can point at other child events, forming a chain of events. These chains
|
Child events can point at other child events, forming a chain of events. These chains
|
||||||
|
|
@ -1882,7 +1882,7 @@ child and parent events being in different rooms or the relationship missing fie
|
||||||
required by the schema below. The events would appear independent of each other or
|
required by the schema below. The events would appear independent of each other or
|
||||||
optionally with an error message (if rendered/handled by the client exclusively).
|
optionally with an error message (if rendered/handled by the client exclusively).
|
||||||
|
|
||||||
`m.relates_to` is described as follows:
|
`m.relates_to` is defined as follows:
|
||||||
|
|
||||||
{{% definition path="api/client-server/definitions/m.relates_to" %}}
|
{{% definition path="api/client-server/definitions/m.relates_to" %}}
|
||||||
|
|
||||||
|
|
@ -1915,7 +1915,7 @@ or aggregation of related events.
|
||||||
|
|
||||||
{{% added-in v="1.3" %}}
|
{{% added-in v="1.3" %}}
|
||||||
|
|
||||||
Some child events can be "aggregated" or "bundled" by the server, depending on their
|
Some child events can be "aggregated" by the server, depending on their
|
||||||
`rel_type`. This can allow a set of child events to be summarised to the client without
|
`rel_type`. This can allow a set of child events to be summarised to the client without
|
||||||
the client needing the child events themselves.
|
the client needing the child events themselves.
|
||||||
|
|
||||||
|
|
@ -1927,12 +1927,12 @@ The actual aggregation format depends on the `rel_type`.
|
||||||
|
|
||||||
{{% boxes/note %}}
|
{{% boxes/note %}}
|
||||||
This specification does not currently describe any `rel_type` which require
|
This specification does not currently describe any `rel_type` which require
|
||||||
aggregation, however [namespaced](/appendices#identifier-grammar) relationship
|
aggregation. This functionality forms a framework for future extensions.
|
||||||
types might have aggregation behaviour.
|
|
||||||
{{% /boxes/note %}}
|
{{% /boxes/note %}}
|
||||||
|
|
||||||
When aggregations are summarised on an event, it is known as a "bundled aggregation"
|
Aggregations are sometimes automatically included by a server alongside the parent
|
||||||
or "bundle" for simplicity. The act of doing this is "bundling".
|
event. This This is known as a "bundled aggregation" or "bundle" for simplicity. The
|
||||||
|
act of doing this is "bundling".
|
||||||
|
|
||||||
When an event is served to the client through the APIs listed below, a `m.relations` field
|
When an event is served to the client through the APIs listed below, a `m.relations` field
|
||||||
is included under `unsigned` if the event has child events which point at it. The `m.relations`
|
is included under `unsigned` if the event has child events which point at it. The `m.relations`
|
||||||
|
|
@ -1979,11 +1979,11 @@ the relationship in a single object. Both are valid bundles, and their exact typ
|
||||||
depend on the `rel_type`.
|
depend on the `rel_type`.
|
||||||
|
|
||||||
{{% boxes/warning %}}
|
{{% boxes/warning %}}
|
||||||
State events do not currently receive the `m.relations` unsigned field. This is not
|
State events do not currently receive bundled aggregations. This is not
|
||||||
necessarily a deliberate design decision, and MSCs which aim to fix this are welcome.
|
necessarily a deliberate design decision, and MSCs which aim to fix this are welcome.
|
||||||
{{% /boxes/warning %}}
|
{{% /boxes/warning %}}
|
||||||
|
|
||||||
The endpoints where the server *should* include the `m.relations` unsigned field are:
|
The endpoints where the server *should* include bundled aggregations are:
|
||||||
|
|
||||||
* [`GET /rooms/{roomId}/messages`](#get_matrixclientv3roomsroomidmessages)
|
* [`GET /rooms/{roomId}/messages`](#get_matrixclientv3roomsroomidmessages)
|
||||||
* [`GET /rooms/{roomId}/context/{eventId}`](#get_matrixclientv3roomsroomidcontexteventid)
|
* [`GET /rooms/{roomId}/context/{eventId}`](#get_matrixclientv3roomsroomidcontexteventid)
|
||||||
|
|
@ -1994,7 +1994,7 @@ The endpoints where the server *should* include the `m.relations` unsigned field
|
||||||
* [`POST /search`](#post_matrixclientv3search) for any matching events under `room_events`.
|
* [`POST /search`](#post_matrixclientv3search) for any matching events under `room_events`.
|
||||||
|
|
||||||
{{% boxes/note %}}
|
{{% boxes/note %}}
|
||||||
The server is **not** required to return bundles/aggregations on deprecated endpoints
|
The server is **not** required to return bundled aggregations on deprecated endpoints
|
||||||
such as `/initialSync`.
|
such as `/initialSync`.
|
||||||
{{% /boxes/note %}}
|
{{% /boxes/note %}}
|
||||||
|
|
||||||
|
|
@ -2010,7 +2010,7 @@ included on the parent's `m.relations` field. Events received in future syncs wo
|
||||||
need to be aggregated manually by the client.
|
need to be aggregated manually by the client.
|
||||||
|
|
||||||
{{% boxes/note %}}
|
{{% boxes/note %}}
|
||||||
Events from [ignored users](#ignoring-users) do not appear in the bundle or aggregation
|
Events from [ignored users](#ignoring-users) do not appear in the aggregation
|
||||||
from the server, however clients might still have events from ignored users cached. Like
|
from the server, however clients might still have events from ignored users cached. Like
|
||||||
with normal events, clients will need to de-aggregate child events sent by ignored users to
|
with normal events, clients will need to de-aggregate child events sent by ignored users to
|
||||||
avoid them being considered in counts. Servers must additionally ensure they do not
|
avoid them being considered in counts. Servers must additionally ensure they do not
|
||||||
|
|
@ -2022,7 +2022,7 @@ when a child event is redacted then the relationship is broken. Therefore, the s
|
||||||
to de-aggregate or disassociate the event once the relationship is lost. Clients with local
|
to de-aggregate or disassociate the event once the relationship is lost. Clients with local
|
||||||
aggregation or which handle redactions locally should do the same.
|
aggregation or which handle redactions locally should do the same.
|
||||||
|
|
||||||
It is suggested that clients perform local echo on aggregations. For instance, aggregating
|
It is suggested that clients perform local echo on aggregations — for instance, aggregating
|
||||||
a new child event into a bundle optimistically until the server returns a failure or the client
|
a new child event into a bundle optimistically until the server returns a failure or the client
|
||||||
gives up on sending the event, at which point the event should be de-aggregated and an
|
gives up on sending the event, at which point the event should be de-aggregated and an
|
||||||
error or similar shown. The client should be cautious to not aggregate an event twice if
|
error or similar shown. The client should be cautious to not aggregate an event twice if
|
||||||
|
|
@ -2032,7 +2032,7 @@ likely using the transaction ID as a temporary event ID until a proper event ID
|
||||||
|
|
||||||
{{% boxes/warning %}}
|
{{% boxes/warning %}}
|
||||||
Due to history visibility restrictions, child events might not be visible to the user
|
Due to history visibility restrictions, child events might not be visible to the user
|
||||||
if they are in a section of history the user cannot see. This can mean inaccurate bundles
|
if they are in a section of history the user cannot see. This can mean inaccurate aggregations
|
||||||
for events that are "out of range".
|
for events that are "out of range".
|
||||||
|
|
||||||
Additionally, if the server is missing portions of the room history then it may not be
|
Additionally, if the server is missing portions of the room history then it may not be
|
||||||
|
|
@ -2047,7 +2047,7 @@ events and is instead paginated: clients can perform local aggregation if needed
|
||||||
allows clients to retrieve child events which do not require aggregation but still make
|
allows clients to retrieve child events which do not require aggregation but still make
|
||||||
use of `rel_type`.
|
use of `rel_type`.
|
||||||
|
|
||||||
This endpoint is particularly useful if the client has lost context on the bundle for
|
This endpoint is particularly useful if the client has lost context on the aggregation for
|
||||||
a parent event and needs to rebuild/verify it.
|
a parent event and needs to rebuild/verify it.
|
||||||
|
|
||||||
{{% boxes/note %}}
|
{{% boxes/note %}}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ type: module
|
||||||
|
|
||||||
{{% changed-in v="1.3" %}}
|
{{% changed-in v="1.3" %}}
|
||||||
|
|
||||||
More common on [`m.room.message`](#mroommessage) events, rich replies are a
|
Rich replies are a
|
||||||
special kind of [relationship](#forming-relationships-between-events) which
|
special kind of [relationship](#forming-relationships-between-events) which
|
||||||
effectively quotes the referenced event for the client to render/process how
|
effectively quotes the referenced event for the client to render/process how
|
||||||
it wishes.
|
it wishes. They are normally used with [`m.room.message`](#mroommessage) events.
|
||||||
|
|
||||||
{{% boxes/note %}}
|
{{% boxes/note %}}
|
||||||
Until v1.3 of the spec, rich replies were limited to `m.room.message` events
|
Until v1.3 of the spec, rich replies were limited to `m.room.message` events
|
||||||
|
|
@ -25,12 +25,12 @@ When possible, events SHOULD include a [fallback representation](#fallbacks-for-
|
||||||
to allow clients which do not render rich replies to still see something which
|
to allow clients which do not render rich replies to still see something which
|
||||||
appears to be a quoted reply.
|
appears to be a quoted reply.
|
||||||
|
|
||||||
Though rich replies are forming a relationship to another event, they do not
|
Though rich replies form a relationship to another event, they do not
|
||||||
use `rel_type` to create this relationship. Instead, a subkey named `m.in_reply_to`
|
use `rel_type` to create this relationship. Instead, a subkey named `m.in_reply_to`
|
||||||
is used to describe the reply's relationship, leaving the other keys of
|
is used to describe the reply's relationship, leaving the other properties of
|
||||||
`m.relates_to` to describe the primary relationship of the event. This means
|
`m.relates_to` to describe the primary relationship of the event. This means
|
||||||
that if an event is simply in reply to another event, without further relationship,
|
that if an event is simply in reply to another event, without further relationship,
|
||||||
the `rel_type` and `event_id` keys of `m.relates_to` become *optional*.
|
the `rel_type` and `event_id` properties of `m.relates_to` become *optional*.
|
||||||
|
|
||||||
An example reply would be:
|
An example reply would be:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
type: object
|
type: object
|
||||||
title: m.relates_to
|
title: m.relates_to
|
||||||
description: |-
|
description: |-
|
||||||
A description of a valid `m.relates_to` definition on a child event. This is contained
|
Describes the relationship of an event to its parent. This is contained
|
||||||
within the event's `content` alongside other fields for the relevant event type.
|
within the event's `content` alongside other fields for the relevant event type.
|
||||||
example: {
|
example: {
|
||||||
# We deliberately "break" the example by including the top-level field so it renders
|
# We deliberately "break" the example by including the top-level field so it renders
|
||||||
|
|
@ -39,5 +39,5 @@ properties:
|
||||||
such.
|
such.
|
||||||
event_id:
|
event_id:
|
||||||
type: string
|
type: string
|
||||||
description: The parent event ID in the same room this event points/relates to.
|
description: The event ID of the event that this event relates to.
|
||||||
required: ['rel_type', 'event_id']
|
required: ['rel_type', 'event_id']
|
||||||
|
|
|
||||||
|
|
@ -41,20 +41,20 @@ paths:
|
||||||
|
|
||||||
When combining the use of `relType` and `eventType`, the server will return
|
When combining the use of `relType` and `eventType`, the server will return
|
||||||
child events which match *both* conditions rather than *either*.
|
child events which match *both* conditions rather than *either*.
|
||||||
operationId: getChildEventsForParentEvent
|
operationId: getRelatingEvents
|
||||||
security:
|
security:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
type: string
|
type: string
|
||||||
name: roomId
|
name: roomId
|
||||||
description: The ID of the room the supposed parent event is in.
|
description: The ID of the room containing the parent event.
|
||||||
required: true
|
required: true
|
||||||
x-example: "!636q39766251:matrix.org"
|
x-example: "!636q39766251:matrix.org"
|
||||||
- in: path
|
- in: path
|
||||||
type: string
|
type: string
|
||||||
name: eventId
|
name: eventId
|
||||||
description: The supposed parent event ID.
|
description: The ID of the parent event whose child events are to be returned.
|
||||||
required: true
|
required: true
|
||||||
x-example: "$asfDuShaf7Gafaw"
|
x-example: "$asfDuShaf7Gafaw"
|
||||||
- in: path
|
- in: path
|
||||||
|
|
@ -157,7 +157,7 @@ paths:
|
||||||
means there are no prior results to fetch, i.e. this is the first batch.
|
means there are no prior results to fetch, i.e. this is the first batch.
|
||||||
404:
|
404:
|
||||||
description: |-
|
description: |-
|
||||||
The supposed parent event was not found or the user does not have permission to read
|
The parent event was not found or the user does not have permission to read
|
||||||
this event (it might be contained in history that is not accessible to the user).
|
this event (it might be contained in history that is not accessible to the user).
|
||||||
examples:
|
examples:
|
||||||
application/json: {
|
application/json: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue