Increase number of names shown in group PM list from 2 to 3

(imported from commit eff308fb1405290488f74d9064fd859d33c99558)
This commit is contained in:
Zev Benjamin 2013-12-05 16:20:20 -05:00
parent 0bf60e243a
commit 6f0477f491
2 changed files with 14 additions and 4 deletions

View File

@ -77,11 +77,12 @@ exports.full_huddle_name = function (huddle) {
exports.short_huddle_name = function (huddle) {
var emails = huddle.split(',');
var names = _.map(emails.slice(0,2), function (email) {
var num_to_show = 3;
var names = _.map(emails.slice(0, num_to_show), function (email) {
var person = people_dict.get(email);
return person ? person.full_name : email;
});
var others = emails.length - 2;
var others = emails.length - num_to_show;
if (others === 1) {
names.push("+ 1 other");

View File

@ -32,6 +32,9 @@ set_global('people_dict', new global.Dict.from({
},
'mark@zulip.com': {
full_name: 'Marky Mark'
},
'norbert@zulip.com': {
full_name: 'Norbert Oswald'
}
}));
@ -120,13 +123,19 @@ var activity = require('js/activity.js');
assert.equal(
activity.short_huddle_name('alice@zulip.com,fred@zulip.com,jill@zulip.com'),
'Alice Smith, Fred Flintstone, + 1 other'
'Alice Smith, Fred Flintstone, Jill Hill'
);
assert.equal(
activity.short_huddle_name('alice@zulip.com,fred@zulip.com,jill@zulip.com,mark@zulip.com'),
'Alice Smith, Fred Flintstone, + 2 others'
'Alice Smith, Fred Flintstone, Jill Hill, + 1 other'
);
assert.equal(
activity.short_huddle_name('alice@zulip.com,fred@zulip.com,jill@zulip.com,mark@zulip.com,norbert@zulip.com'),
'Alice Smith, Fred Flintstone, Jill Hill, + 2 others'
);
}());
(function test_huddle_fraction_present() {