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

Messages that are replies and do not use formatting cannot be edited more than once #1313

Closed
20kdc opened this issue Jun 25, 2023 · 2 comments
Labels
area: timeline type: bug Something isn't working

Comments

@20kdc
Copy link

20kdc commented Jun 25, 2023

Describe the bug

Um... See title or reproduction instructions?

Reproduction

  1. Markdown formatting is enabled in settings. (Unsure if essential)
  2. Reply to a message. The reply must not use markdown features (so it doesn't generate a formatted body, perhaps?)
  3. Edit the reply. Do not use markdown features.
  4. Edit the reply again. This will cause the error and the edit will silently fail.

Importantly, m.new_content will not have formatted_body in messages that break this way.

Expected behavior

Uh... no error and for the message to be edited.

Platform and versions

1. OS: Ubuntu MATE 22.04.2 LTS
2. Browser: Firefox 102.12.0esr (64-bit)
3. Cinny version: v2.2.6 (app.cinny.in)
4. Matrix homeserver: matrix.org

Additional context

Materials that may or may not be useful:

image
image
image

Example of the source to a message that cannot be further edited:

{
  "content": {
    "body": "> <@20kdc:matrix.org> This is a message.\n\n * This is a reply to that message that I am going to edit.\nThis is an edit.",
    "format": "org.matrix.custom.html",
    "formatted_body": "<mx-reply><blockquote><a href=\"https://matrix.to/#/!yDMeZGveGjjPHJVagK%3Amatrix.org/%24unsiVC0GP7GC_W60VU6UIUtzqWeo11OxkV1xLhsX0_M\">In reply to</a><a href=\"https://matrix.to/#/%4020kdc%3Amatrix.org\">@20kdc:matrix.org</a><br />This is a message.</blockquote></mx-reply> * This is a reply to that message that I am going to edit.<br>This is an edit.",
    "m.new_content": {
      "body": "This is a reply to that message that I am going to edit.\nThis is an edit.",
      "msgtype": "m.text"
    },
    "m.relates_to": {
      "event_id": "$9DyIp-qkkWV_h7WHyYyvMaG-LflZUEynS0y_IUKsQmg",
      "rel_type": "m.replace"
    },
    "msgtype": "m.text"
  },
  "origin_server_ts": 1687725600719,
  "sender": "@20kdc:matrix.org",
  "type": "m.room.message",
  "unsigned": {
    "age": 297,
    "transaction_id": "m1687725600670.2"
  },
  "event_id": "$_ByLPPp9PABr6f7DOoxMf74_d5Wk7m4aoO_N9uWezmw",
  "room_id": "!yDMeZGveGjjPHJVagK:matrix.org"
}
@kfiven kfiven added type: bug Something isn't working area: timeline labels Jun 26, 2023
@kfiven
Copy link
Collaborator

kfiven commented Jun 26, 2023

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'substring')
    at RoomsInput.getContent (RoomsInput.js:236:35)
    at RoomsInput.sendEditedMessage (RoomsInput.js:412:26)
    at onSave (Message.jsx:811:39)
    at onSubmit (Message.jsx:308:76)
    at HTMLUnknownElement.callCallback2 (react-dom.development.js:3945:14)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:16)
    at invokeGuardedCallback (react-dom.development.js:4056:31)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4070:25)
    at executeDispatch (react-dom.development.js:8243:3)
    at processDispatchQueueItemsInOrder (react-dom.development.js:8275:7)

@jivanpal
Copy link

jivanpal commented Jul 6, 2023

Confirmed affects me on v2.2.6 Flatpak on Pop OS 22.04.

@kfiven kfiven closed this as completed Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: timeline type: bug Something isn't working
Projects
Status: ✅ WYSIWYG and timeline
Development

No branches or pull requests

3 participants