element-hq / element-hq/element-android

Composer: text looses formatting after editing a markdown message or editing a reply message

Open
#8,602 11 comments 3 reactions 0 assignees View on GitHub
A-Composer O-Frequent S-Major T-Defect
Dominant language
Kotlin
Stars
3.7k
Forks
917
PR merge metrics
No merged PRs in 30d

Description

### Steps to reproduce

#### wrong formatting when editing a message:
1. enable markdown messages
2. send any message, e.g.
```md
# test
> foo
```
3. the message is sent correctly
4. edit the message - the message is rendered in the composer like in the chat (with big header and a cite) but the formatting marks are missing.
in my case i just added a `/n/n´bar´` (i was not able to break/ exit the comment either)
5. submit message
6. the new edited message is (without the cite):
> test <- not a header
>
> foo <- not a cite
>
> `bar` <- that works because i added the formatting marks

if you add the formatting marks manually before submitting the edit, the message is sent correctly.

![1](https://github.com/vector-im/element-android/assets/74739057/13e8e2cb-792e-4904-9f85-cd5b7097cfc0)

#### duplicate `in reply to …`:

when replying to any message and editing the reply the same bug occures:
1. markdown can be enabled but it is not required
2. send any message
3. reply to that message with any message
4. edit the repy - the message is rendered with the
> > in reply to @…
> \*initial message\*
>
> \*reply message\*
which is applied to the message after submitting the edit draft.
5. the edited message is:
> > in reply to @…
> > \*initial message\*
>
> in reply to @…
> \*initial message\*
>
> \*reply message\*

![2](https://github.com/vector-im/element-android/assets/74739057/a559159e-6949-4d20-9744-ccc959a72ed4)

there might be much more bugs when editing messages i haven't found.

### Outcome

#### What did you expect?

the message is rendered correctly

#### What happened instead?

i believe the problem is that the rendered message text is put into the composer instead of the raw message text so all formatting of the message gets lost when editing

### Your phone model

OnePlus 5T

### Operating system version

Android 10

### Application version and app store

Element version v1.6.5 from Google Play

### Homeserver

Synapse v1.89.0

### Will you send logs?

No

### Are you willing to provide a PR?

No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.