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

MSC1695 Message Edits #1695

Closed
75 changes: 75 additions & 0 deletions proposals/1695-message-edits.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Proposal
========

I propose for message edits to follow a similar format to replies, using `m.relates_to`.
The content of the edited message should be inside `m.replaces.new_content` which can
be accessed if the client is edit-aware. If the client is not aware, it can use `content.body`
and `content.formatted_body` to render an approximation of the edit. The fallback should be
in the format given below.

Clients should always favour fetching the source from `m.replaces.event_id` where possible,
rather than using the fallback as the fallback can be faked. Furthermore, clients should refuse
to display with an appropriate message when the sender of the source event and the edit event differ.

It should be noted that this allows any event to be replaced by an entirely different set of content.
The client should make a best effort attempt to describe the relationship between the two events for
both the fallback and representation.

If the edit event's content is invalid, it is acceptable to display/keep the old event in place with a warning.

User should be warned that editing an an
Copy link
Member

Choose a reason for hiding this comment

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

an an?! :D


Example
-------

Original message:
```javascript
{
"content": {
"body": "This is an example message I want to edit.",
"msgtype": "m.text"
},
"event_id": "$1539340060524DGxMc:half-shot.uk",
"sender": "@Half-Shot:half-shot.uk",
"type": "m.room.message",
"room_id": "!IPcexxPYNJKmTvRfoV:half-shot.uk"
}
```

New edited message:
```javascript
{
"content": {
"body": "Edited: ~~This is an example message I want to edit~~ This is the edited message",
"format": "org.matrix.custom.html",
"formatted_body": "Edited: <del>This is an example message I want to edit</del> This is the edited message",
turt2live marked this conversation as resolved.
Show resolved Hide resolved
"m.relates_to": {
"m.replaces": {
turt2live marked this conversation as resolved.
Show resolved Hide resolved
"event_id": "$1539340060524DGxMc:half-shot.uk",
"new_content": {
"body": "This is the edited message.",
"msgtype": "m.text"
}
}
},
"msgtype": "m.text"
},
"event_id": "$1539340066525PiiWI:half-shot.uk",
"sender": "@Half-Shot:half-shot.uk",
"type": "m.room.message",
"room_id": "!IPcexxPYNJKmTvRfoV:half-shot.uk"
}
```

Problems
--------

Clients will also render the original event without the edit if the client isn't aware of
the edited event since event aggregations aren't a thing yet. This is considered an
acceptable risk for this proposal and aggregations are considered an extension to
message edits for Matrix.
Copy link
Member

Choose a reason for hiding this comment

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

Probably worth spelling out here too that the intention here is more to standardise metadata than provide a good UX in clients pre-aggregations.


It should be noted that many bridges and bots already show edits in the form of a
fallback already, so this event only strives to add some specced metadata to allow
clients to render them clearly.In the future, this proposal could be extended to
use aggregations to show a list of edits made to a message.