From 1e02fc140b2540cab7496cf176a3e77579374019 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Wed, 26 Sep 2012 14:28:22 -0400 Subject: [PATCH] Make add_messages do everything relating to message adding Now that it's only called from get_updates_longpoll, we don't need to break out specific parts that are only needed there. (imported from commit 60d1cb25d0044ed1b2325d977b869617587e6a0f) --- zephyr/static/js/zephyr.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index be00b57469..52481e0105 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -764,6 +764,12 @@ function add_messages(zephyrs) { // Even when narrowed, add messages to the home view so they exist when we un-narrow. add_to_table(zephyrs, 'zhome', function () { return true; }); + $.each(zephyrs, function () { + zephyr_array.push(this); + if (this.id === initial_pointer) + select_and_show_by_id(initial_pointer); + }); + if (autocomplete_needs_update) update_autocomplete(); } @@ -788,11 +794,6 @@ function get_updates_longpoll() { if (data && data.zephyrs) { add_messages(data.zephyrs); - $.each(data.zephyrs, function () { - zephyr_array.push(this); - if (this.id === initial_pointer) - select_and_show_by_id(initial_pointer); - }); } setTimeout(get_updates_longpoll, 0); },