Remove defensive code in update_person().

The code to keep page_params.people_list and realm_people_dict
values in sync with people_dict was unnecessary, as they are
the same underlying object.

(imported from commit 0a901213977ed21a0587ed1590ab5434be756f51)
This commit is contained in:
Steve Howell
2014-01-21 16:24:20 -05:00
parent 9160fb3ed5
commit 93deefec8d

View File

@@ -83,29 +83,24 @@ function update_person(person) {
// we just push out changes to that field. As we add more things
// that can change, this will need to either get complicated or be
// replaced by MVC
var i;
if (! people_dict.has(person.email)) {
blueslip.error("Got update_person event for unexpected user",
{email: person.email});
return;
}
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...
realm_people_dict.get(person.email).full_name = person.full_name;
for (i = 0; i < page_params.people_list.length; i++) {
if (page_params.people_list[i].email === person.email) {
page_params.people_list[i].full_name = person.full_name;
break;
}
}
if (person.email === page_params.email) {
page_params.fullname = person.full_name;
}
activity.set_user_statuses([]);
// TODO: update sender names on messages