mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 19:31:58 +00:00
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:
@@ -83,29 +83,24 @@ function update_person(person) {
|
|||||||
// we just push out changes to that field. As we add more things
|
// 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
|
// that can change, this will need to either get complicated or be
|
||||||
// replaced by MVC
|
// replaced by MVC
|
||||||
var i;
|
|
||||||
if (! people_dict.has(person.email)) {
|
if (! people_dict.has(person.email)) {
|
||||||
blueslip.error("Got update_person event for unexpected user",
|
blueslip.error("Got update_person event for unexpected user",
|
||||||
{email: person.email});
|
{email: person.email});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var person_obj = people_dict.get(person.email);
|
var person_obj = people_dict.get(person.email);
|
||||||
|
|
||||||
if (people_by_name_dict.has(person_obj.full_name)) {
|
if (people_by_name_dict.has(person_obj.full_name)) {
|
||||||
people_by_name_dict.set(person.full_name, person_obj);
|
people_by_name_dict.set(person.full_name, person_obj);
|
||||||
people_by_name_dict.del(person_obj.full_name);
|
people_by_name_dict.del(person_obj.full_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
person_obj.full_name = person.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) {
|
if (person.email === page_params.email) {
|
||||||
page_params.fullname = person.full_name;
|
page_params.fullname = person.full_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.set_user_statuses([]);
|
activity.set_user_statuses([]);
|
||||||
|
|
||||||
// TODO: update sender names on messages
|
// TODO: update sender names on messages
|
||||||
|
|||||||
Reference in New Issue
Block a user