mirror of https://github.com/zulip/zulip.git
Rename zephyr_dict and zephyr_array.
(imported from commit 5d93fddc1758c0ee47390cfe599732a60a8d817a)
This commit is contained in:
parent
78c303e44a
commit
f1e90cde8c
|
@ -37,7 +37,7 @@ var globals =
|
|||
+ ' update_autocomplete autocomplete_needs_update'
|
||||
|
||||
// zephyr.js
|
||||
+ ' zephyr_array zephyr_dict'
|
||||
+ ' message_array message_dict'
|
||||
+ ' status_classes clear_table add_to_table instance_list'
|
||||
+ ' keep_pointer_in_view respond_to_zephyr'
|
||||
+ ' select_zephyr select_zephyr_by_id'
|
||||
|
|
|
@ -12,7 +12,7 @@ function do_narrow(description, filter_function) {
|
|||
|
||||
// Empty the filtered table right before we fill it again
|
||||
clear_table('zfilt');
|
||||
add_to_table(zephyr_array, 'zfilt', filter_function, 'bottom');
|
||||
add_to_table(message_array, 'zfilt', filter_function, 'bottom');
|
||||
|
||||
// Show the new set of messages.
|
||||
$("#zfilt").addClass("focused_table");
|
||||
|
@ -28,7 +28,7 @@ function do_narrow(description, filter_function) {
|
|||
}
|
||||
|
||||
function narrow_huddle() {
|
||||
var original = zephyr_dict[selected_zephyr_id];
|
||||
var original = message_dict[selected_zephyr_id];
|
||||
do_narrow("Huddles with " + original.reply_to, function (other) {
|
||||
return other.reply_to === original.reply_to;
|
||||
});
|
||||
|
@ -42,7 +42,7 @@ function narrow_all_personals() {
|
|||
|
||||
function narrow_personals() {
|
||||
// Narrow to personals with a specific user
|
||||
var original = zephyr_dict[selected_zephyr_id];
|
||||
var original = message_dict[selected_zephyr_id];
|
||||
var other_party;
|
||||
if (original.display_recipient === email) {
|
||||
other_party = original.sender_email;
|
||||
|
@ -59,7 +59,7 @@ function narrow_personals() {
|
|||
}
|
||||
|
||||
function narrow_class() {
|
||||
var original = zephyr_dict[selected_zephyr_id];
|
||||
var original = message_dict[selected_zephyr_id];
|
||||
var message = original.display_recipient;
|
||||
do_narrow(message, function (other) {
|
||||
return (other.type === 'class' &&
|
||||
|
@ -68,7 +68,7 @@ function narrow_class() {
|
|||
}
|
||||
|
||||
function narrow_instance() {
|
||||
var original = zephyr_dict[selected_zephyr_id];
|
||||
var original = message_dict[selected_zephyr_id];
|
||||
if (original.type !== 'class')
|
||||
return;
|
||||
|
||||
|
@ -82,7 +82,7 @@ function narrow_instance() {
|
|||
|
||||
// Called for the 'narrow by class' hotkey.
|
||||
function narrow_by_recipient() {
|
||||
switch (zephyr_dict[selected_zephyr_id].type) {
|
||||
switch (message_dict[selected_zephyr_id].type) {
|
||||
case 'personal': narrow_personals(); break;
|
||||
case 'huddle': narrow_huddle(); break;
|
||||
case 'class': narrow_class(); break;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var zephyr_array = [];
|
||||
var zephyr_dict = {};
|
||||
var message_array = [];
|
||||
var message_dict = {};
|
||||
var instance_list = [];
|
||||
|
||||
$(function () {
|
||||
|
@ -115,7 +115,7 @@ function get_huddle_recipient_names(zephyr) {
|
|||
|
||||
function respond_to_zephyr(reply_type) {
|
||||
var zephyr, tabname;
|
||||
zephyr = zephyr_dict[selected_zephyr_id];
|
||||
zephyr = message_dict[selected_zephyr_id];
|
||||
if (zephyr.type === "class") {
|
||||
$("#class").val(zephyr.display_recipient);
|
||||
$("#instance").val(zephyr.instance);
|
||||
|
@ -273,14 +273,14 @@ function add_to_table(zephyrs, table_name, filter_function, where) {
|
|||
var top_messages = [];
|
||||
$.each(top_group, function (index, id) {
|
||||
get_zephyr_row(id, table_name).remove();
|
||||
top_messages.push(zephyr_dict[id]);
|
||||
top_messages.push(message_dict[id]);
|
||||
});
|
||||
zephyrs = zephyrs.concat(top_messages);
|
||||
|
||||
// Delete the leftover recipient label.
|
||||
table.find('.recipient_row:first').remove();
|
||||
} else {
|
||||
prev = zephyr_dict[table.find('tr:last-child').attr('zid')];
|
||||
prev = message_dict[table.find('tr:last-child').attr('zid')];
|
||||
}
|
||||
|
||||
$.each(zephyrs, function (index, zephyr) {
|
||||
|
@ -397,7 +397,7 @@ function add_zephyr_metadata(dummy, zephyr) {
|
|||
break;
|
||||
}
|
||||
|
||||
zephyr_dict[zephyr.id] = zephyr;
|
||||
message_dict[zephyr.id] = zephyr;
|
||||
}
|
||||
|
||||
function add_messages(data) {
|
||||
|
@ -413,9 +413,9 @@ function add_messages(data) {
|
|||
}
|
||||
|
||||
if (data.where === 'top') {
|
||||
zephyr_array = data.messages.concat(zephyr_array);
|
||||
message_array = data.messages.concat(message_array);
|
||||
} else {
|
||||
zephyr_array = zephyr_array.concat(data.messages);
|
||||
message_array = message_array.concat(data.messages);
|
||||
}
|
||||
|
||||
if (narrowed)
|
||||
|
@ -426,7 +426,7 @@ function add_messages(data) {
|
|||
|
||||
// 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) && (zephyr_dict.hasOwnProperty(initial_pointer))) {
|
||||
if ((selected_zephyr_id === -1) && (message_dict.hasOwnProperty(initial_pointer))) {
|
||||
select_and_show_by_id(initial_pointer);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue