message_list_view: Remove check for mention class.

This check caused us to only run the code inside that block if the
message mentioned the current user (since that's when the `mention`
class is added to the main message row).

While this was a useful performance optimization, it probably was a
small one, not worth it for the correctness cost.
This commit is contained in:
varunvaruns9
2018-12-18 19:02:58 +05:30
committed by Tim Abbott
parent 6d51c065d3
commit eca1ce7f1f

View File

@@ -452,26 +452,24 @@ MessageListView.prototype = {
content.addClass('rtl'); content.addClass('rtl');
} }
if (row.hasClass('mention')) { row.find('.user-mention').each(function () {
row.find('.user-mention').each(function () { var user_id = get_user_id_for_mention_button(this);
var user_id = get_user_id_for_mention_button(this); // We give special highlights to the mention buttons
// We give special highlights to the mention buttons // that refer to the current user.
// that refer to the current user. if (user_id === "*" || people.is_my_user_id(user_id)) {
if (user_id === "*" || people.is_my_user_id(user_id)) { // Either a wildcard mention or us, so mark it.
// Either a wildcard mention or us, so mark it. $(this).addClass('user-mention-me');
$(this).addClass('user-mention-me'); // TODO: We should probably also mark user groups
// TODO: We should probably also mark user groups // you're with the user-mention-me tag.
// you're with the user-mention-me tag. }
} if (user_id && user_id !== "*" && !$(this).find(".highlight").length) {
if (user_id && user_id !== "*" && !$(this).find(".highlight").length) { // If it's a mention of a specific user, edit the
// If it's a mention of a specific user, edit the // mention text to show the user's current name,
// mention text to show the user's current name, // assuming that you're not searching for text
// assuming that you're not searching for text // inside the highlight.
// inside the highlight. $(this).text("@" + people.get_person_from_user_id(user_id).full_name);
$(this).text("@" + people.get_person_from_user_id(user_id).full_name); }
} });
});
}
// Display emoji (including realm emoji) as text if // Display emoji (including realm emoji) as text if
// page_params.emojiset is 'text'. // page_params.emojiset is 'text'.