Fix formatting for Group PMs in the right sidebar.

We now sort users by the lower case value of their
full names in each of the links in the "GROUP PMs"
section of the right sidebar.  We still use "+n others"
for big huddles.
This commit is contained in:
Steve Howell 2016-11-23 08:25:43 -08:00 committed by Tim Abbott
parent d953eca14c
commit 604079a9d4
1 changed files with 4 additions and 1 deletions

View File

@ -150,10 +150,13 @@ exports.short_huddle_name = function (huddle) {
var user_ids = huddle.split(','); var user_ids = huddle.split(',');
var num_to_show = 3; var num_to_show = 3;
var names = _.map(user_ids.slice(0, num_to_show), function (user_id) { var names = _.map(user_ids, function (user_id) {
var person = people.get_person_from_user_id(user_id); var person = people.get_person_from_user_id(user_id);
return person.full_name; return person.full_name;
}); });
names = _.sortBy(names, function (name) { return name.toLowerCase(); });
names = names.slice(0, num_to_show);
var others = user_ids.length - num_to_show; var others = user_ids.length - num_to_show;
if (others === 1) { if (others === 1) {