diff --git a/tools/jslint/check-all.js b/tools/jslint/check-all.js index cc0fcf3490..49af62856b 100644 --- a/tools/jslint/check-all.js +++ b/tools/jslint/check-all.js @@ -60,7 +60,7 @@ var globals = // zephyr.js + ' message_array message_dict get_updates_params' + ' clear_table add_to_table add_messages' - + ' subject_dict same_stream_and_subject' + + ' subject_dict people_dict same_stream_and_subject' + ' keep_pointer_in_view move_pointer_at_page_top_and_bottom' + ' respond_to_message' + ' select_message select_message_by_id' diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index bdfa30e9df..4336f04c85 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -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); } });