Rename selected_zephyr_id to selected_message_id.

(imported from commit bbb368efdd5010b6dfdaaf60f3f48904b40671af)
This commit is contained in:
Tim Abbott 2012-10-09 18:09:25 -04:00
parent e10966f1bb
commit ae97a88e72
3 changed files with 18 additions and 18 deletions

View File

@ -42,7 +42,7 @@ var globals =
+ ' keep_pointer_in_view respond_to_zephyr' + ' keep_pointer_in_view respond_to_zephyr'
+ ' select_message select_message_by_id' + ' select_message select_message_by_id'
+ ' scroll_to_selected select_and_show_by_id' + ' scroll_to_selected select_and_show_by_id'
+ ' selected_zephyr selected_zephyr_id' + ' selected_zephyr selected_message_id'
+ ' at_top_of_viewport at_bottom_of_viewport' + ' at_top_of_viewport at_bottom_of_viewport'
; ;

View File

@ -8,7 +8,7 @@ function do_narrow(description, filter_function) {
narrowed = filter_function; narrowed = filter_function;
// Your pointer isn't changed when narrowed. // Your pointer isn't changed when narrowed.
persistent_zephyr_id = selected_zephyr_id; persistent_zephyr_id = selected_message_id;
// Empty the filtered table right before we fill it again // Empty the filtered table right before we fill it again
clear_table('zfilt'); clear_table('zfilt');
@ -23,12 +23,12 @@ function do_narrow(description, filter_function) {
$("#currently_narrowed_to").html(description).attr("title", description); $("#currently_narrowed_to").html(description).attr("title", description);
$("#zhome").removeClass("focused_table"); $("#zhome").removeClass("focused_table");
select_and_show_by_id(selected_zephyr_id); select_and_show_by_id(selected_message_id);
scroll_to_selected(); scroll_to_selected();
} }
function narrow_huddle() { function narrow_huddle() {
var original = message_dict[selected_zephyr_id]; var original = message_dict[selected_message_id];
do_narrow("Huddles with " + original.reply_to, function (other) { do_narrow("Huddles with " + original.reply_to, function (other) {
return other.reply_to === original.reply_to; return other.reply_to === original.reply_to;
}); });
@ -42,7 +42,7 @@ function narrow_all_personals() {
function narrow_personals() { function narrow_personals() {
// Narrow to personals with a specific user // Narrow to personals with a specific user
var original = message_dict[selected_zephyr_id]; var original = message_dict[selected_message_id];
var other_party; var other_party;
if (original.display_recipient === email) { if (original.display_recipient === email) {
other_party = original.sender_email; other_party = original.sender_email;
@ -59,7 +59,7 @@ function narrow_personals() {
} }
function narrow_class() { function narrow_class() {
var original = message_dict[selected_zephyr_id]; var original = message_dict[selected_message_id];
var message = original.display_recipient; var message = original.display_recipient;
do_narrow(message, function (other) { do_narrow(message, function (other) {
return (other.type === 'class' && return (other.type === 'class' &&
@ -68,7 +68,7 @@ function narrow_class() {
} }
function narrow_instance() { function narrow_instance() {
var original = message_dict[selected_zephyr_id]; var original = message_dict[selected_message_id];
if (original.type !== 'class') if (original.type !== 'class')
return; return;
@ -82,7 +82,7 @@ function narrow_instance() {
// Called for the 'narrow by class' hotkey. // Called for the 'narrow by class' hotkey.
function narrow_by_recipient() { function narrow_by_recipient() {
switch (message_dict[selected_zephyr_id].type) { switch (message_dict[selected_message_id].type) {
case 'personal': narrow_personals(); break; case 'personal': narrow_personals(); break;
case 'huddle': narrow_huddle(); break; case 'huddle': narrow_huddle(); break;
case 'class': narrow_class(); break; case 'class': narrow_class(); break;

View File

@ -44,8 +44,8 @@ $(function () {
} }
}); });
var selected_zephyr_id = -1; /* to be filled in on document.ready */ var selected_message_id = -1; /* to be filled in on document.ready */
var selected_zephyr; // = get_zephyr_row(selected_zephyr_id) var selected_zephyr; // = get_zephyr_row(selected_message_id)
var received = { var received = {
first: -1, first: -1,
last: -1, last: -1,
@ -115,7 +115,7 @@ function get_huddle_recipient_names(zephyr) {
function respond_to_zephyr(reply_type) { function respond_to_zephyr(reply_type) {
var zephyr, tabname; var zephyr, tabname;
zephyr = message_dict[selected_zephyr_id]; zephyr = message_dict[selected_message_id];
if (zephyr.type === "class") { if (zephyr.type === "class") {
$("#class").val(zephyr.display_recipient); $("#class").val(zephyr.display_recipient);
$("#instance").val(zephyr.instance); $("#instance").val(zephyr.instance);
@ -143,7 +143,7 @@ function respond_to_zephyr(reply_type) {
// Called by mouseover etc. // Called by mouseover etc.
function select_message_by_id(zephyr_id) { function select_message_by_id(zephyr_id) {
if (zephyr_id === selected_zephyr_id) { if (zephyr_id === selected_message_id) {
return; return;
} }
select_message(get_zephyr_row(zephyr_id), false); select_message(get_zephyr_row(zephyr_id), false);
@ -161,14 +161,14 @@ function update_selected_zephyr(zephyr) {
zephyr.addClass('selected_zephyr'); zephyr.addClass('selected_zephyr');
var new_selected_id = get_id(zephyr); var new_selected_id = get_id(zephyr);
if (!narrowed && new_selected_id !== selected_zephyr_id) { if (!narrowed && new_selected_id !== selected_message_id) {
// Narrowing is a temporary view on top of the home view and // Narrowing is a temporary view on top of the home view and
// doesn't permanently affect where you are. // doesn't permanently affect where you are.
// //
// We also don't want to post if there's no effective change. // We also don't want to post if there's no effective change.
$.post("update", {pointer: new_selected_id}); $.post("update", {pointer: new_selected_id});
} }
selected_zephyr_id = new_selected_id; selected_message_id = new_selected_id;
selected_zephyr = zephyr; selected_zephyr = zephyr;
} }
@ -426,7 +426,7 @@ function add_messages(data) {
// If we received the initially selected message, select it on the client side, // 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. // but not if the user has already selected another one during load.
if ((selected_zephyr_id === -1) && (message_dict.hasOwnProperty(initial_pointer))) { if ((selected_message_id === -1) && (message_dict.hasOwnProperty(initial_pointer))) {
select_and_show_by_id(initial_pointer); select_and_show_by_id(initial_pointer);
} }
@ -437,8 +437,8 @@ function add_messages(data) {
// //
// We also need to re-select the message by ID, because we might have // We also need to re-select the message by ID, because we might have
// removed and re-added the row as part of prepend collapsing. // removed and re-added the row as part of prepend collapsing.
if ((data.where === 'top') && (selected_zephyr_id >= 0)) { if ((data.where === 'top') && (selected_message_id >= 0)) {
select_and_show_by_id(selected_zephyr_id); select_and_show_by_id(selected_message_id);
} }
if (autocomplete_needs_update) if (autocomplete_needs_update)
@ -494,7 +494,7 @@ function at_bottom_of_viewport() {
function keep_pointer_in_view() { function keep_pointer_in_view() {
var candidate; var candidate;
var viewport = $(window); var viewport = $(window);
var next_message = get_zephyr_row(selected_zephyr_id); var next_message = get_zephyr_row(selected_message_id);
if (above_view_threshold(next_message) && (!at_top_of_viewport())) { if (above_view_threshold(next_message) && (!at_top_of_viewport())) {
while (above_view_threshold(next_message)) { while (above_view_threshold(next_message)) {