From 6de6ced2908d6c7546e503cff7ebc849d776bf47 Mon Sep 17 00:00:00 2001 From: Scott Feeney Date: Wed, 21 Aug 2013 14:52:27 -0400 Subject: [PATCH] Fix PM unread counts not displaying This was broken in two ways: 1. Commit ad59d6f78042ce89, "Make the left sidebar and right sidebar more consistent", pushed last Monday, changed the markup for the right sidebar without changing a selector in stream_list.js that was looking for the old markup. 2. Even then, whenever new user presence information came in, we would rerender the user list and blow away the unread counts. This commit patches around that by updating unread counts after rendering the user list. I'm not sure what broke this or how it was working before. (imported from commit 53ed40139e257e44411e918d1ecdce3a49e9ee51) --- static/js/stream_list.js | 2 +- static/js/ui.js | 4 ++++ tools/jslint/check-all.js | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/static/js/stream_list.js b/static/js/stream_list.js index 896dfb8a0e..0ebe37279d 100644 --- a/static/js/stream_list.js +++ b/static/js/stream_list.js @@ -64,7 +64,7 @@ function get_filter_li(type, name) { if (type === 'stream') { return $("#stream_sidebar_" + subs.stream_id(name)); } else if (type === "private") { - return $(".user_sidebar_entry > a[data-email='" + name + "']"); + return $("li.user_sidebar_entry[data-email='" + name + "']"); } return iterate_to_find("#" + type + "_filters > li", name); } diff --git a/static/js/ui.js b/static/js/ui.js index 3302717427..7506687db6 100644 --- a/static/js/ui.js +++ b/static/js/ui.js @@ -1483,6 +1483,10 @@ exports.set_presence_list = function (users, presence_info) { var user_info = [my_info].concat(_.map(user_emails, info_for)); $('#user_presences').html(templates.render('user_presence_rows', {users: user_info})); + // FIXME: This should probably be rendered in the template directly, but + // currently we have to update unread counts after rendering the template + // or they get blown away. + update_unread_counts(); }; // Save the compose content cursor position and restore when we diff --git a/tools/jslint/check-all.js b/tools/jslint/check-all.js index 7fae99ab8d..722090f55a 100644 --- a/tools/jslint/check-all.js +++ b/tools/jslint/check-all.js @@ -56,6 +56,7 @@ var globals = + ' mark_message_as_read' + ' send_summarize_in_home' + ' send_summarize_in_stream' + + ' update_unread_counts' ;