From 9323abddd923e930102edcdbcb7dca791cec20b8 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Wed, 26 Sep 2012 17:52:17 -0400 Subject: [PATCH] Don't jump the pointer if the user already selected a message during load (imported from commit 69a3f11059ee4764f1625df7774ff611fff99537) --- zephyr/static/js/zephyr.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index cb5eaf439f..33dd3cbd38 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -307,7 +307,7 @@ $(function () { $("#current_settings form").ajaxForm(options); }); -var selected_zephyr_id = 0; /* to be filled in on document.ready */ +var selected_zephyr_id = -1; /* to be filled in on document.ready */ var selected_zephyr; // = get_zephyr_row(selected_zephyr_id) var last_received = -1; @@ -777,8 +777,12 @@ function add_messages(zephyrs) { $.each(zephyrs, function () { zephyr_array.push(this); - if (this.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 ((this.id === initial_pointer) && (selected_zephyr_id === -1)) { select_and_show_by_id(initial_pointer); + } }); if (autocomplete_needs_update)