Skip to content

feat: Add NewContent into RoomMessageEvent #15

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

Closed
wants to merge 1 commit into from

Conversation

diamondburned
Copy link
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
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
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