mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 20:41:46 +00:00
Keep a dictionary of user email address to person object
(imported from commit 16d63fefff3bda33cfc2f90398539b5e2d9bb499)
This commit is contained in:
@@ -60,7 +60,7 @@ var globals =
|
|||||||
// zephyr.js
|
// zephyr.js
|
||||||
+ ' message_array message_dict get_updates_params'
|
+ ' message_array message_dict get_updates_params'
|
||||||
+ ' clear_table add_to_table add_messages'
|
+ ' 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'
|
+ ' keep_pointer_in_view move_pointer_at_page_top_and_bottom'
|
||||||
+ ' respond_to_message'
|
+ ' respond_to_message'
|
||||||
+ ' select_message select_message_by_id'
|
+ ' select_message select_message_by_id'
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ var message_array = [];
|
|||||||
var message_dict = {};
|
var message_dict = {};
|
||||||
var message_in_table = {zhome: {}, zfilt: {}};
|
var message_in_table = {zhome: {}, zfilt: {}};
|
||||||
var subject_dict = {};
|
var subject_dict = {};
|
||||||
|
var people_dict = {};
|
||||||
|
|
||||||
var viewport = $(window);
|
var viewport = $(window);
|
||||||
|
|
||||||
@@ -28,6 +29,17 @@ var message_groups = {
|
|||||||
|
|
||||||
var disable_pointer_movement = false;
|
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
|
// 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
|
// in below_view_threshold as opposed to vice versa? Mostly to handle
|
||||||
// the case of gigantic messages. Imagine the case of a selected
|
// 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
|
// Do the hasOwnProperty() call via the prototype to avoid problems
|
||||||
// with keys like "hasOwnProperty"
|
// with keys like "hasOwnProperty"
|
||||||
if (! typeahead_helper.known_to_typeahead(person)) {
|
if (! typeahead_helper.known_to_typeahead(person)) {
|
||||||
people_list.push(person);
|
add_person(person);
|
||||||
typeahead_helper.autocomplete_needs_update(true);
|
typeahead_helper.autocomplete_needs_update(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user