-
-
Notifications
You must be signed in to change notification settings - Fork 833
Annotate highlighted events with notification reason #10599
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good code! I've only got some optional comments regarding code style, but those are not necessarily any "better", just different.
src/utils/event/highlight.ts
Outdated
if (rule.rule_id === RuleId.ContainsUserName) { | ||
return _t("Your username was mentioned."); | ||
} | ||
if (rule.rule_id === RuleId.ContainsDisplayName) { | ||
return _t("Your display name was mentioned."); | ||
} | ||
if (rule.rule_id === RuleId.AtRoomNotification || rule.rule_id === RuleId.IsRoomMention) { | ||
return _t("This message mentions the room."); | ||
} | ||
if (rule.rule_id === RuleId.IsUserMention) { | ||
return _t("You were explicitly mentioned."); | ||
} | ||
if (rule.kind === PushRuleKind.ContentSpecific) { | ||
return _t(`Your keyword '%(keyword)s' was mentioned.`, { keyword: rule.pattern! }); | ||
} | ||
return ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be a switch-case, at least according to the code style
On first impression I really like this from a user perspective but the more I played with it the more I realised that it's quite odd to have a hover icon in the action bar... All other actions there have a click thru but the bell is a hover over (which might not be a11y friendly?) As folks often miss the "(edited)" text is a button I wonder if we can combine the two things here... So we could pick a slightly different icon, on click the Edited modal appears. The hover over of the button would still tell users why they were pinged, then clicking on it will show the edits. Alternatively maybe hovering over the "(edited)" text shows the tool tip? Either way, I think we need some design input here: @rufuskahler could you help us out? |
This is a really nice implementation @kerryarchibald – However, I have my doubts about using the action bar for the reasons Danielle mentioned. Furthermore, I'd like to discuss other ways of solving the problem closer to the root cause, e.g with Compound, we're moving away from red highlighted text for notifications. @daniellekirkwood – This sounds like more consensus is needed between Product & Design. |
Fixes element-hq/element-web#24927
With matrix-org/matrix-js-sdk#3284
For highlighted messages, adds a notification icon to the message action bar explaining the highlight in a tooltip.
(May be expanded on later to add a dialog with rule management/anti-abuse options)
Checklist
Here's what your changelog entry will look like:
✨ Features