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

Matthew/msc1849 rewrite #2154

Merged
merged 6 commits into from
Jul 29, 2019
Merged

Matthew/msc1849 rewrite #2154

merged 6 commits into from
Jul 29, 2019

Conversation

ara4n
Copy link
Member

@ara4n ara4n commented Jul 5, 2019

WIP of rewriting MSC1849

"msgtype": "m.text",
},
"m.relates_to": {
"rel_type": "m.replace",
Copy link
Contributor

@bwindels bwindels Jul 5, 2019

Choose a reason for hiding this comment

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

I think we might need a way to preserve the rel_type upon redacting an edit. As it stands we can't tell a redacted edit from a redacted message, causing riot to render redacted edits in the timeline. We could keep m.relates_to/rel_type in the content, like we do for other fields.


Bundles of relations for a given event are
paginated to prevent overloading the client with relations, and may be traversed by
via the new `/relations` API (which iterates over all relations for an event) or the
Copy link
Member

Choose a reason for hiding this comment

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

Heads up that we'd like the original event (not just the id) to be returned in calls to /relations to make showing message edit history simpler.

Context: matrix-org/synapse#5595

Copy link
Member Author

Choose a reason for hiding this comment

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

@anoadragon453 i'm a bit dubious about the implementation here. the requirement to show the original message is specific to edits - not relations in general. for instance, if i iterate over the reactions for a message, i don't want to waste bandwidth getting sent the original message again.

Was there a reason we don't just call /event to grab the original event as a separate API call to iterating over the actual relations via /relations?

Or alternatively, make the field only show up if you're explicitly paginating m.replace relations?

@@ -1,241 +1,245 @@
# Proposal for aggregations via m.relates_to
Copy link
Member

Choose a reason for hiding this comment

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

Should mention that redacting an original event will redact all relations.

Should this be done by sending hundreds of reactions event into a room (one for each reaction/edit)? Or would it be better to be able to specify something that redacts multiple events.

Copy link
Member Author

Choose a reason for hiding this comment

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

have tried to clear this up by explaining you don't have to redact the relations.

* `m.annotation` aggregations provide the `type` of the relation event, the
aggregation `key`, and the `count` of the number of annotations of that
`type` and `key` which reference that event.
* `m.replace` relations do not appear in bundled aggregations at all, as they
Copy link
Contributor

@bwindels bwindels Jul 10, 2019

Choose a reason for hiding this comment

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

They do appear in the bundle as it's implemented currently in synapse, and that is needed for clients to know that the event is edited, at what time, and by who, and to continue aggregating m.replace events locally on top of it.

Ftr, the aggregated data looks like this:

      "m.replace": {
        "event_id": "$PHdn4WW8aOhdEPfAfZWmwYJSodFSJrDzojabJ0u1iao",
        "origin_server_ts": 1562763768320,
        "sender": "@bruno1:localhost"
      }

Copy link
Member Author

Choose a reason for hiding this comment

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

ah, okay, understood.

Copy link
Member Author

Choose a reason for hiding this comment

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

or not... i've added XXXs to try to explain my confusion.


### Relation types

This proposal defines three `rel_type`s, each which provide different behaviour
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This proposal defines three `rel_type`s, each which provide different behaviour
This proposal defines three `rel_type`s, each of which provide different behaviour

original event to clients. Another usage of an annotation is e.g. for bots, who
could use annotations to report the success/failure or progress of a command.
```json
"type": "m.room.message",
Copy link
Contributor

Choose a reason for hiding this comment

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

Add an outer level of braces to match the other examples here.

@bwindels
Copy link
Contributor

element-hq/element-web#10136 has some discussion on how reactions should interact with edited messages. The consensus there seems that reactions should be sent to the last edit (if any). Right now clients always send a reaction to the original event.

We should probably spec this behaviour, as diverging clients behaviour will end up not showing each others reactions. We should potentially also enforce this server-side (reject reactions for edited messages on anything but the last edit).

"msgtype": "m.text",
"m.new_content": {
"body": "Hello! My name is bar",
"msgtype": "m.text",
Copy link
Member

Choose a reason for hiding this comment

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

The proposal doesn't seem to mention reply fallbacks at all, even though they're a problem. Riot was changed to add the fallbacks to m.new_content in matrix-org/matrix-react-sdk#3192, but edit events don't contain any metadata indicating that the reply fallback exists.

While the HTML <mx-reply> tag can technically be parsed away safely even without knowing the event has a reply fallback, the same does not apply for the plaintext body. Therefore, it's impossible to use the actual plaintext of an edit without fetching the original event and checking if it was a reply, which is a huge waste of time.

It might not be a problem in clients who probably have the original event stored somewhere, but it is in bots and bridges where the original event is really not needed for anything. It's especially a problem in bots since they don't deal with formatted_body at all in most cases.

IMO we should be phasing out reply fallbacks by not including them in m.new_content, because clients that understand edits are new enough to understand replies (and if they don't understand replies, that's completely the client dev's fault).

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@ara4n
Copy link
Member Author

ara4n commented Jul 29, 2019

i'm going to merge this into the 1849 branch to avoid further comment fragmentation and confusion. i think the only orphaned comment this leaves here is #2154 (comment)... which has made its way into the XXXs on the MSC anyway.

@ara4n ara4n marked this pull request as ready for review July 29, 2019 23:31
@ara4n ara4n merged commit c313489 into matthew/msc1849 Jul 29, 2019
@richvdh
Copy link
Member

richvdh commented Aug 22, 2019

superceded by #1849

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants