mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-13 17:44:56 +08:00
## Issue
When we open a chat channel we can see that any mentions of our own
username is highlighted, but any new mentions of our username after that
point is not highlighted.
This is due to how user mentions are upserted as part of a background
job when a message is sent, but we return the message bus response
straight away, meaning that we don't have the mentioned user info to
apply the `--current-user` class for styling for self mentions.
## The Solution
This change adds dynamic styling of the current user mentions by adding
the style rules to the page header based on their username. So the
dynamic style will look like:
```js
.mention[href="/u/johndoe"] { background: var(--tertiary-400); }
```
This works for both mentions in posts/topics and chat. Now we no longer
rely on applying a `--current-user` class.
Internal ref - /t/173085
|
||
|---|---|---|
| .. | ||
| javascripts | ||
| stylesheets | ||