Highlight alert words in mentions you send to yourself.

Fixes #6946.
This commit is contained in:
Steve Howell 2017-10-12 13:11:43 -07:00 committed by Tim Abbott
parent a9d25f8719
commit 52299ce987
2 changed files with 17 additions and 1 deletions

View File

@ -14,7 +14,9 @@ function escape_user_regex(value) {
}
exports.process_message = function (message) {
if (!exports.notifies(message)) {
// Parsing for alert words is expensive, so we rely on the host
// to tell us there any alert words to even look for.
if (!message.alerted) {
return;
}
@ -47,6 +49,10 @@ exports.process_message = function (message) {
};
exports.notifies = function (message) {
// We exclude ourselves from notifications when we type one of our own
// alert words into a message, just because that can be annoying for
// certain types of workflows where everybody on your team, including
// yourself, sets up an alert word to effectively mention the team.
return !people.is_current_user(message.sender_email) && message.alerted;
};

View File

@ -230,6 +230,16 @@ exports.process_from_server = function process_from_server(messages) {
sent_messages.mark_disparity(message.local_id);
}
// Update our flags based on what the server gave us.
client_message.flags = message.flags;
message_store.set_message_booleans(client_message, client_message.flags);
// We don't try to highlight alert words locally, so we have to
// do it now. (Note that we will indeed highlight alert words in
// messages that we sent to ourselves, since we might want to test
// that our alert words are set up correctly.)
alert_words.process_message(client_message);
// Previously, the message had the "local echo" timestamp set
// by the browser; if there was some round-trip delay to the
// server, the actual server-side timestamp could be slightly