Skip to content

feat: Add NewContent into RoomMessageEvent#15

Closed
diamondburned wants to merge 1 commit intochanbakjsd:masterfrom
diamondburned:new_content
Closed

feat: Add NewContent into RoomMessageEvent#15
diamondburned wants to merge 1 commit intochanbakjsd:masterfrom
diamondburned:new_content

Conversation

@diamondburned
Copy link
Copy Markdown
Contributor

This commit adds the NewContent field into RoomMessageEvent. It is
supposed to be an object with the same type as RoomMessageEvent and
usually contains the message information that will replace the old
event's body.

For reference, here's an example JSON:

{
  "content": {
    "body": " * b",
    "m.new_content": {
      "body": "b",
      "msgtype": "m.text"
    },
    "m.relates_to": {
      "event_id": "$eventID",
      "rel_type": "m.replace"
    },
    "msgtype": "m.text"
  }
}

This commit adds the NewContent field into RoomMessageEvent. It is
supposed to be an object with the same type as RoomMessageEvent and
usually contains the message information that will replace the old
event's body.

For reference, here's an example JSON:

  {
    "content": {
      "body": " * b",
      "m.new_content": {
        "body": "b",
        "msgtype": "m.text"
      },
      "m.relates_to": {
        "event_id": "$eventID",
        "rel_type": "m.replace"
      },
      "msgtype": "m.text"
    }
  }
@chanbakjsd
Copy link
Copy Markdown
Owner

I think the comment above on m.relates_to should be updated.
It might also be worth noting in new_content's comment that it is part of MSC2676 (under review at matrix-org/matrix-spec-proposals#2676).

I am not sure what the best way to do this is but there should also be a way for the user to access RelType.

@diamondburned
Copy link
Copy Markdown
Contributor Author

On second thought, since the user is manually adding the m.rel_type field
anyway, it would probably be better if they also manually add the NewContent
field by extending the struct.

Closing this PR because of that.

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.

2 participants