Keep a dictionary of user email address to person object

(imported from commit 16d63fefff3bda33cfc2f90398539b5e2d9bb499)
This commit is contained in:
Zev Benjamin
2013-01-14 16:18:30 -05:00
parent 26f38065cd
commit cb8c67b325
2 changed files with 14 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ var message_array = [];
var message_dict = {};
var message_in_table = {zhome: {}, zfilt: {}};
var subject_dict = {};
var people_dict = {};
var viewport = $(window);
@@ -28,6 +29,17 @@ var message_groups = {
var disable_pointer_movement = false;
function add_person(person) {
people_list.push(person);
people_dict[person.email] = person;
}
$(function () {
$.each(people_list, function (idx, person) {
people_dict[person.email] = person;
});
});
// Why do we look at the 'bottom' in above_view_threshold and the top
// in below_view_threshold as opposed to vice versa? Mostly to handle
// the case of gigantic messages. Imagine the case of a selected
@@ -452,7 +464,7 @@ function add_message_metadata(message, dummy) {
// Do the hasOwnProperty() call via the prototype to avoid problems
// with keys like "hasOwnProperty"
if (! typeahead_helper.known_to_typeahead(person)) {
people_list.push(person);
add_person(person);
typeahead_helper.autocomplete_needs_update(true);
}
});