From f03efcd7880d33dc575438ac1485bbda70cefb1b Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Tue, 2 Oct 2012 18:23:03 -0400 Subject: [PATCH] Simplify initial pointer selection This code had decayed from something more substantial into a kind of silly loop. (imported from commit a6668c19bd6d50325460ac4fa4146d7f82fec58b) --- zephyr/static/js/zephyr.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index 5c4ab03bb9..a29e14c446 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -981,13 +981,11 @@ function add_messages(data) { // Even when narrowed, add messages to the home view so they exist when we un-narrow. add_to_table(data.zephyrs, 'zhome', function () { return true; }, data.where); - $.each(data.zephyrs, function () { - // If we received the initially selected message, select it on the client side, - // but not if the user has already selected another one during load. - if ((this.id === initial_pointer) && (selected_zephyr_id === -1)) { - select_and_show_by_id(initial_pointer); - } - }); + // If we received the initially selected message, select it on the client side, + // but not if the user has already selected another one during load. + if ((selected_zephyr_id === -1) && (initial_pointer in zephyr_dict)) { + select_and_show_by_id(initial_pointer); + } // If we prepended messages, then we need to scroll back to the pointer. // This will mess with the user's scrollwheel use; possibly we should be