element-hq / element-hq/element-android
Strange formatted message handling
- Dominant language
- Kotlin
- Stars
- 3.7k
- Forks
- 917
- Avg merge
- 8d 20h
- Merged PRs (30d)
- 1
Description
riotX shows strange display behavior with formatted messages.
# Expected behavior:
if a message contains `"format":"org.matrix.custom.html" `and a `formatted_body` field, the contents of the `formatted_body` are displayed.
# Current behavior:
if the `body` field contains a code block in markdown, the body field is parsed as markdown and displayed instead of the formatted body(markdown parsing only if it is a `org.matrix.custom.html` message).
Furthermore, when the html body is used, the pre/code block is not properly formatted(see third example in the screenshots below).
screenshots:
Expected message display(riot desktop):

Riotx display:

Message sources:
```
"content": {
"msgtype": "m.text",
"format": "org.matrix.custom.html",
"body": "```\ncode body 1",
"formatted_body": "
html body 1"
},
```
```
"content": {
"msgtype": "m.text",
"format": "org.matrix.custom.html",
"body": "normal body 2",
"formatted_body": "
html body 2"
},
```
```
"content": {
"body": "```\ncode body 3",
"msgtype": "m.text"
},
```
@tulir identified the source for the issue [here](https://github.com/vector-im/riotX-android/blob/5fa247a0c5c02e34ea2caf6b68e458b115eb21ce/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt#L356)
Our troubleshooting discussion in the #riotx room can be found [here](https://matrix.to/#/!gGkYcJLTzcNrfERksd:matrix.org/$a2pBDO4VhlGZyxQyM2KJRGUeMC6aIk5PbYuwSyghwAI?via=matrix.org&via=privacytools.io&via=tchncs.de)
Tested version: 0.19.0 [40019000] (F-be9393fa)
Contributor guide
Assessment
This issue has not been assessed yet.