|
| 1 | +# MSC4269: Unambiguous mentions in body |
| 2 | + |
| 3 | +The use of display names makes it difficult to parse user mentions from a message body. Clients can |
| 4 | +also make it difficult to type user IDs without having them replaced with a mention. |
| 5 | + |
| 6 | +Some clients, such as bots, have no use for or do not want to deal with the complexity of parsing |
| 7 | +the pseudo-HTML of the `formatted_body`. In addition, the `m.mentions` added by [MSC3952] is not |
| 8 | +enough, either, as the listed user IDs lack the context of the message body. |
| 9 | + |
| 10 | +Translating the display names in the message body back to user IDs is difficult, if not impossible. |
| 11 | +However, the reverse operation - translating unambiguous user IDs in the body into display names - |
| 12 | +is trivial in comparison. |
| 13 | + |
| 14 | +Thus it is proposed that the message `body` should contain user IDs instead of display names. |
| 15 | + |
| 16 | +## Proposal |
| 17 | + |
| 18 | +The specified client behavior for user and room mentions is modified so that the event's `body` |
| 19 | +should contain the unambiguous user ID, canonical room alias or room ID instead of the anchor's |
| 20 | +text component. |
| 21 | + |
| 22 | +## Potential issues |
| 23 | + |
| 24 | +Some clients, especially bridges, might rely on the body containing the display name for a good user |
| 25 | +experience. However, it would not be difficult to modify such a client to translate user IDs in the |
| 26 | +message body to display names. |
| 27 | + |
| 28 | +## Alternatives |
| 29 | + |
| 30 | +- Change the spec so that the anchor's text component is the user ID. It would make user mentions |
| 31 | + more consistent with room mentions. This changes the `formatted_body` as well, potentially |
| 32 | + requiring more changes to clients. |
| 33 | + |
| 34 | +- Specify the use of markdown links in the `body` matching the anchors in the `formatted_body`. |
| 35 | + While easier to parse, it's not as simple as just the user ID. |
| 36 | + |
| 37 | +- Bracket display names in the `body` somehow, making it possible to look them up, perhaps with the |
| 38 | + help of `m.mentions`. However, they remain ambiguous. |
| 39 | + |
| 40 | +## Security considerations |
| 41 | + |
| 42 | +None. |
| 43 | + |
| 44 | +## Unstable prefix |
| 45 | + |
| 46 | +None. |
| 47 | + |
| 48 | +## Dependencies |
| 49 | + |
| 50 | +None. |
| 51 | + |
| 52 | +[MSC3952]: https://github.com/matrix-org/matrix-spec-proposals/pull/3952 |
0 commit comments