From 01aad70910ee6e557eebaef5892b575bbd6cfd6e Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Mon, 23 Jan 2017 15:44:08 -0800 Subject: [PATCH] bug fix: Fix recent regression with at-mentioning. One of my commits from yesterday erroneously set the "mentioned" flag on messages that weren't mentioning the current user, so you would get the pink/salmon background when you sent at-mentions to other people. Now we check the user_id before setting the flag. --- frontend_tests/node_tests/echo.js | 8 ++++++++ static/js/echo.js | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend_tests/node_tests/echo.js b/frontend_tests/node_tests/echo.js index 7500842b23..1537c71c13 100644 --- a/frontend_tests/node_tests/echo.js +++ b/frontend_tests/node_tests/echo.js @@ -64,6 +64,14 @@ people.add({ email: 'cordelia@zulip.com', }); +people.add({ + full_name: 'Leo', + user_id: 102, + email: 'leo@zulip.com', +}); + +people.initialize_current_user(101); + var stream_data = global.stream_data; var denmark = { subscribed: false, diff --git a/static/js/echo.js b/static/js/echo.js index 0136131e2f..1cf217f1d4 100644 --- a/static/js/echo.js +++ b/static/js/echo.js @@ -46,7 +46,9 @@ exports.apply_markdown = function apply_markdown(message) { userMentionHandler: function (name) { var person = people.get_by_name(name); if (person !== undefined) { - push_uniquely(message.flags, 'mentioned'); + if (people.is_my_user_id(person.user_id)) { + push_uniquely(message.flags, 'mentioned'); + } return '' + '@' + person.full_name + '';