Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec reference relationships #1206

Merged
merged 6 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelogs/client_server/newsfragments/1206.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `m.reference` relations, as per [MSC3267](https://github.com/matrix-org/matrix-spec-proposals/pull/3267).
2 changes: 2 additions & 0 deletions content/client-server-api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1973,6 +1973,7 @@ This specification describes the following relationship types:
* [Rich replies](#rich-replies) (**Note**: does not use `rel_type`).
* [Event replacements](#event-replacements).
* [Threads](#threading).
* [References](#reference-relations)

#### Aggregations

Expand Down Expand Up @@ -2640,3 +2641,4 @@ systems.
{{< cs-module name="spaces" >}}
{{< cs-module name="event_replacements" >}}
{{< cs-module name="threading" >}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed recently that I'd forgotten to update the table at https://spec.matrix.org/unstable/client-server-api/#summary for message edits. We should probably do so for threading?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, we should indeed. Will take a look in a different PR.

{{< cs-module name="reference_relations" >}}
55 changes: 55 additions & 0 deletions content/client-server-api/modules/reference_relations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
type: module
---

### Reference relations

{{% added-in v="1.4" %}}

Generically referencing another event can be done with a `rel_type` of `m.reference`
as a form of [relationship](#forming-relationships-between-events). There is no
implied meaning behind the reference, and is usually context-dependent. One
example is the [key verification framework](#key-verification-framework) which uses
reference relations to associate distinct events with a specific verification attempt.

{{% boxes/note %}}
Clients which wish to use threads or replies are expected to use other relationship
types than references. References are typically used to associate data rather than
messages.
{{% /boxes/note %}}

#### Server behaviour

##### Server-side aggregation of `m.reference`

The aggregation format of `m.reference` relations consists of a single `chunk` property,
which lists all the events which `m.reference` the event (the parent). Currently,
only a single `event_id` field is present on the events in the `chunk`.

An example `m.reference` would be:

```json
{
"content": {
"m.relates_to": {
"rel_type": "m.reference",
"event_id": "$another_event"
}
// other content fields as required
}
// other fields as required by events
}
```

The [bundle](#aggregations) under `m.relations` would appear similar to the following:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/bundle/aggregation/ ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bundle, in reference to the same language m.replace uses.


```json
{
"m.reference": {
"chunk": [
{ "event_id": "$one" },
{ "event_id": "$two" }
]
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ properties:
enum:
- m.reference
description: |-
The relationship type.
The relationship type. Currently, this can only be an
[`m.reference`](/client-server-api/#reference-relations) relationship type.
event_id:
type: string
description: |-
Expand Down