-
-
Notifications
You must be signed in to change notification settings - Fork 828
Show updated relation reply from edited message #6809
Show updated relation reply from edited message #6809
Conversation
Part of https://github.com/vector-im/element-web/issues/10391#issuecomment-906131724 When `m.relates_to` -> `m.in_reply_to` is provided in `m.new_content` for an edited message, use the updated reply. ex. ```json { "type": "m.room.message", "content": { "body": " * foo bar", "msgtype": "m.text", "m.new_content": { "body": "foo bar", "msgtype": "m.text", "m.relates_to": { "m.in_reply_to": { "event_id": "$qkjmFBTEc0VvfVyzq1CJuh1QZi_xDIgNEFjZ4Pq34og" } } }, "m.relates_to": { "rel_type": "m.replace", "event_id": "$lX9MRe9ZTFOOvnU8PRVbvr1wqGtYvNQ1rSot-iUTN5k" } } } ```
// | ||
// We're using ev.getContent() over ev.getWireContent() to make sure | ||
// we grab the latest edit with potentially new relations. | ||
const mRelatesTo = ev.getContent()['m.relates_to']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works because event.getContent()
is smart enough to pull from the latest replacing event (message edit), this._replacingEvent.getContent()["m.new_content"]
.
We probably want to also update matrix-js-sdk
event.getRelation()
to pull from getContent()
as well, src/models/event.ts#L1077-L1087
. I can create a follow-up PR after this is deemed acceptable 🙇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating the js-sdk makes sense, though I'm a bit concerned that the impact could be greater than we anticipate. Until it's reported to cause bugs, we should leave it alone I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know what you mean 🤔
I feel like we may be leaving other clients in the dust if we don't change it though. Someone making a client, bridge, etc just falls into the pitfall of not supporting this use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do have a breaking change queued up for the js-sdk's next release, so squeezing it in there would be the safest bet I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I'll skip on adjusting it there because trying to make the change and I run into the rel_type
and event_id
constraint which isn't present for m.in_repy_to
and not sure of the downstream effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
// | ||
// We're using ev.getContent() over ev.getWireContent() to make sure | ||
// we grab the latest edit with potentially new relations. | ||
const mRelatesTo = ev.getContent()['m.relates_to']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating the js-sdk makes sense, though I'm a bit concerned that the impact could be greater than we anticipate. Until it's reported to cause bugs, we should leave it alone I think.
I think the CI is unhappy because of things outside of your control: merging develop back into this branch should fix it. |
Thanks for the review @turt2live 🦐 Happy to see this use case supported now! |
@turt2live After pondering about element-hq/element-web#19062, I came up with a previous use case that is now broken. If you reply to a message originally, then edit the message, the reply disappears. This worked previously because we always looked at the original message. Will need to think of something smarter here. Would you prefer to revert in the mean-time? |
that does sound not-great :( reverting is probably the best course of action for now, at least until we can figure out how all these systems are meant to work together (iirc edits and reply fallbacks in particular are largely undefined spec and MSC wise). Are you able to take a look at what might be going sideways? |
This reverts commit eaab8e1.
Yes, I'll write some tests around this too so we don't regress what we know 👍 |
v2 created at #6817 ⏩ |
…nd-quoted-messages * origin/develop: (80 commits) Revert "Show updated relation reply from edited message (#6809)" Show updated relation reply from edited message (#6809) yarn upgrade Pin react too... Pin typescript/types version Fix checks to show prompt to start new chats Fix comment lint fix tests Update comment reflecting tracking scheme via analytics ID Remove all room data from tracking Fix import, convert event type to constant fix lockfile Remove replies from hidden events when shown with `messages.ViewSourceEvent` (#6796) Convert StatusMessageContextMenu to TS Convert GenericTextContextMenu to TS Convert GenericElementContextMenu to TS Convert MemberStatusMessageAvatar to TS More lint lint ...
Oh, and I wondered why the threaded things are disappearing yesterday and couldn't figure out what's going on! 😄 |
Show updated relation reply from edited message
When
m.relates_to
->m.in_reply_to
is provided inm.new_content
for an edited message, use the updated reply.
ex.
Here's what your changelog entry will look like:
✨ Features
Preview: https://61421f65dde597075b63cc01--matrix-react-sdk.netlify.app
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.