mention: Fix mention highlighting in unsubscribed streams.

Rules followed:
1. Bold and highlighted background if the mention was processed
as a mention that includes you.
2. Bold personal mention (but not highlighted) if you were mentioned
but not subscribed at the time.
3. Otherwise not bold, no highlighting.

As we plan to keep the mention pill CSS the same if a user
was mentioned via that personal/wildcard/usergroup mention
irrespective of whether the user is subscribed or not, we use
usermessage flags to determine when to add 'user-mention-me' class.

Fixes #27654.
This commit is contained in:
Prakhar Pratyush
2023-11-23 21:47:37 +05:30
committed by Tim Abbott
parent 73152671e3
commit 0c159c5f47
4 changed files with 83 additions and 127 deletions

View File

@@ -417,7 +417,16 @@ export class MessageListView {
// message didn't include a user mention, then it was a usergroup/wildcard
// mention (which is the only other option for `mentioned` being true).
if (message_container.msg.mentioned_me_directly && is_user_mention) {
message_container.mention_classname = "direct_mention";
// Highlight messages having personal mentions only in DMs and subscribed streams.
if (
message_container.msg.type === "private" ||
stream_data.is_user_subscribed(
message_container.msg.stream_id,
people.my_current_user_id(),
)
) {
message_container.mention_classname = "direct_mention";
}
} else {
message_container.mention_classname = "group_mention";
}