element-hq / element-hq/element-web

Element Web fills in mentions information for code blocks & spoiler tags

Open
#25,266 3 comments 0 reactions 0 assignees View on GitHub
A-Notifications O-Occasional S-Minor T-Defect Z-GetYourUpdates Z-Spec-Compliance
Dominant language
TypeScript
Stars
13.5k
Forks
2.8k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

Sending a code-block or a spoiler tag with a pill of another user should not add that user to the mentions property (per MSC3952), it is a bit weird to reproduce, but:

1. Enable intentional mentions in the labs flags
1. Create a code block (triple ticks)
2. Mention a user (`@clokep`)
3. Close the code block (triple ticks)
4. Send the message
5. View the resulting message source

Alternately for spoiler tags:

1. Enable intentional mentions in the labs flags
1. Type `/spoiler @clokep`
4. Send the message
5. View the resulting message source

### Outcome

#### What did you expect?

I did not expect the mentioned user to be placed in the `org.matrix.msc3952.mentions` property and the event to be rendered as normal code.

#### What happened instead?

1. The user is placed into the mentions property.
2. The *message* itself doesn't have a pill, however (there's no matrix.to link).

Message source for code block:

```json
{
"room_id": "!asdf,
"type": "m.room.message",
"content": {
"msgtype": "m.text",
"body": "Hello:\n\n```\nclokep \n```",
"format": "org.matrix.custom.html",
"formatted_body": "

Hello:

\n
[clokep](https://matrix.to/#/@clokep:matrix.org) \n
\n",
"org.matrix.msc3952.mentions": {
"user_ids": [
"@clokep:matrix.org"
]
}
}
}
```

Message source for spoiler:

```json
{
"room_id": "!asdf",
"type": "m.room.message",
"content": {
"msgtype": "m.text",
"format": "org.matrix.custom.html",
"body": "Hi @clokep:matrix.org",
"formatted_body": "Hi @clokep:matrix.org",
"org.matrix.msc3952.mentions": {
"user_ids": [
"@clokep:matrix.org"
]
}
}
}
```

### Operating system

All

### Browser information

N/A

### URL for webapp

develop.element.io

### Application version

Element version: 1.11.30 Olm version: 3.2.12

### Homeserver

Ask me

### Will you send logs?

No

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in develop.element.io with intentional mentions enabled, using both a triple-backtick code block and the /spoiler command, then inspect the resulting message source. Trace the mention extraction and formatted rendering paths for these inputs; done means users inside code blocks and spoiler tags are not added to org.matrix.msc3952.mentions and code remains rendered normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.