mirror of https://github.com/zulip/zulip.git
Keep track of people by full name for client-side usermentions
(imported from commit 6c88b53913ed7eca7d75ad0d2263d63e277ee65c)
This commit is contained in:
parent
685ab1a583
commit
651382b313
|
@ -12,9 +12,10 @@ var home_msg_list = new MessageList('zhome',
|
||||||
var narrowed_msg_list;
|
var narrowed_msg_list;
|
||||||
var current_msg_list = home_msg_list;
|
var current_msg_list = home_msg_list;
|
||||||
|
|
||||||
// The following two Dicts point to the same objects
|
// The following three Dicts point to the same objects
|
||||||
// All people we've seen
|
// All people we've seen
|
||||||
var people_dict = new Dict();
|
var people_dict = new Dict();
|
||||||
|
var people_by_name_dict = new Dict();
|
||||||
// People in this realm
|
// People in this realm
|
||||||
var realm_people_dict = new Dict();
|
var realm_people_dict = new Dict();
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ var waiting_on_browser_scroll = true;
|
||||||
function add_person(person, in_realm) {
|
function add_person(person, in_realm) {
|
||||||
page_params.people_list.push(person);
|
page_params.people_list.push(person);
|
||||||
people_dict.set(person.email, person);
|
people_dict.set(person.email, person);
|
||||||
|
people_by_name_dict.set(person.full_name, person);
|
||||||
person.pm_recipient_count = 0;
|
person.pm_recipient_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +74,7 @@ function remove_person(person) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
people_dict.del(person.email);
|
people_dict.del(person.email);
|
||||||
|
people_by_name_dict.del(person.full_name);
|
||||||
realm_people_dict.del(person.email);
|
realm_people_dict.del(person.email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +89,12 @@ function update_person(person) {
|
||||||
{email: person.email});
|
{email: person.email});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
people_dict.get(person.email).full_name = person.full_name;
|
var person_obj = people_dict.get(person.email);
|
||||||
|
if (people_by_name_dict.has(person_obj.full_name)) {
|
||||||
|
people_by_name_dict.set(person.full_name, person_obj);
|
||||||
|
people_by_name_dict.del(person_obj.full_name);
|
||||||
|
}
|
||||||
|
person_obj.full_name = person.full_name;
|
||||||
// This should be the same object, but...
|
// This should be the same object, but...
|
||||||
realm_people_dict.get(person.email).full_name = person.full_name;
|
realm_people_dict.get(person.email).full_name = person.full_name;
|
||||||
for (i = 0; i < page_params.people_list.length; i++) {
|
for (i = 0; i < page_params.people_list.length; i++) {
|
||||||
|
@ -1243,6 +1251,7 @@ function consider_bankruptcy() {
|
||||||
|
|
||||||
_.each(page_params.people_list, function (person) {
|
_.each(page_params.people_list, function (person) {
|
||||||
people_dict.set(person.email, person);
|
people_dict.set(person.email, person);
|
||||||
|
people_by_name_dict.set(person.full_name, person);
|
||||||
realm_people_dict.set(person.email, person);
|
realm_people_dict.set(person.email, person);
|
||||||
person.pm_recipient_count = 0;
|
person.pm_recipient_count = 0;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue