subs: compare names using localCompare.

(imported from commit e4dcfe5147601221e720ea6622266402ed09f18a)
This commit is contained in:
Jessica McKellar 2013-02-01 18:07:50 -05:00
parent a8a5d0b511
commit a9f5513181
1 changed files with 6 additions and 5 deletions

View File

@ -434,14 +434,15 @@ function ajaxSubscribeForCreation(stream, principals, invite_only) {
});
}
function people_sort(person1, person2) {
function people_cmp(person1, person2) {
// Compares objects of the form used in people_list.
if (person1.full_name < person2.full_name) {
var name_cmp = person1.full_name.localeCompare(person2.full_name);
if (name_cmp < 0) {
return -1;
} else if (person1.full_name > person2.full_name) {
} else if (name_cmp > 0) {
return 1;
}
return person1.email < person2.email ? -1 : 1;
return person1.email.localeCompare(person2.email);
}
function show_new_stream_modal() {
@ -453,7 +454,7 @@ function show_new_stream_modal() {
});
$('#people_to_add').html(templates.new_stream_users({
users: people_minus_you.sort(people_sort)
users: people_minus_you.sort(people_cmp)
}));
$('#stream-creation').modal("show");
}