mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
filter: Use ', ' to separate names in PM title.
This is a prep commit for the navbar redesign.
This commit is contained in:
@@ -1319,6 +1319,11 @@ function make_private_sub(name, stream_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run_test('navbar_helpers', () => {
|
run_test('navbar_helpers', () => {
|
||||||
|
// make sure title has names separated with correct delimiters
|
||||||
|
function properly_separated_names(names) {
|
||||||
|
return names.join(', ');
|
||||||
|
}
|
||||||
|
|
||||||
function test_redirect_url_with_search(test_case) {
|
function test_redirect_url_with_search(test_case) {
|
||||||
test_case.operator.push({ operator: 'search', operand: 'fizzbuzz'});
|
test_case.operator.push({ operator: 'search', operand: 'fizzbuzz'});
|
||||||
const filter = new Filter(test_case.operator);
|
const filter = new Filter(test_case.operator);
|
||||||
@@ -1436,21 +1441,21 @@ run_test('navbar_helpers', () => {
|
|||||||
operator: pm_with,
|
operator: pm_with,
|
||||||
is_common_narrow: true,
|
is_common_narrow: true,
|
||||||
icon: 'envelope',
|
icon: 'envelope',
|
||||||
title: [joe.full_name],
|
title: properly_separated_names([joe.full_name]),
|
||||||
redirect_url_with_search: '/#narrow/pm-with/' + joe.user_id + '-' + joe.email.split('@')[0],
|
redirect_url_with_search: '/#narrow/pm-with/' + joe.user_id + '-' + joe.email.split('@')[0],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
operator: group_pm,
|
operator: group_pm,
|
||||||
is_common_narrow: true,
|
is_common_narrow: true,
|
||||||
icon: 'envelope',
|
icon: 'envelope',
|
||||||
title: [joe.full_name, steve.full_name],
|
title: properly_separated_names([joe.full_name, steve.full_name]),
|
||||||
redirect_url_with_search: '/#narrow/pm-with/' + joe.user_id + ',' + steve.user_id + '-group',
|
redirect_url_with_search: '/#narrow/pm-with/' + joe.user_id + ',' + steve.user_id + '-group',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
operator: group_pm_including_missing_person,
|
operator: group_pm_including_missing_person,
|
||||||
is_common_narrow: true,
|
is_common_narrow: true,
|
||||||
icon: 'envelope',
|
icon: 'envelope',
|
||||||
title: [joe.full_name, steve.full_name, 'sally@doesnotexist.com'],
|
title: properly_separated_names([joe.full_name, steve.full_name, 'sally@doesnotexist.com']),
|
||||||
redirect_url_with_search: '/#narrow/pm-with/undefined',
|
redirect_url_with_search: '/#narrow/pm-with/undefined',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -573,7 +573,11 @@ Filter.prototype = {
|
|||||||
}
|
}
|
||||||
return people.get_by_email(email).full_name;
|
return people.get_by_email(email).full_name;
|
||||||
});
|
});
|
||||||
return names;
|
|
||||||
|
// We use join to handle the addition of a comma and space after every name
|
||||||
|
// and also to ensure that we return a string and not an array so that we
|
||||||
|
// can have the same return type as other cases.
|
||||||
|
return names.join(', ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user