mirror of
https://github.com/zulip/zulip.git
synced 2025-11-20 06:28:23 +00:00
filter: Use Intl.ListFormat rather than .join(", ").
This commit is contained in:
@@ -976,11 +976,7 @@ export class Filter {
|
|||||||
}
|
}
|
||||||
return person.full_name;
|
return person.full_name;
|
||||||
});
|
});
|
||||||
|
return util.format_array_as_list(names, "long", "conjunction");
|
||||||
// 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(", ");
|
|
||||||
}
|
}
|
||||||
if (term_types.length === 1 && _.isEqual(term_types, ["sender"])) {
|
if (term_types.length === 1 && _.isEqual(term_types, ["sender"])) {
|
||||||
const email = this.operands("sender")[0];
|
const email = this.operands("sender")[0];
|
||||||
|
|||||||
@@ -1495,7 +1495,11 @@ test("navbar_helpers", () => {
|
|||||||
|
|
||||||
// make sure title has names separated with correct delimiters
|
// make sure title has names separated with correct delimiters
|
||||||
function properly_separated_names(names) {
|
function properly_separated_names(names) {
|
||||||
return names.join(", ");
|
const names_internationalized = new Intl.ListFormat("en", {
|
||||||
|
style: "long",
|
||||||
|
type: "conjunction",
|
||||||
|
}).format(names);
|
||||||
|
return names_internationalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_redirect_url_with_search(test_case) {
|
function test_redirect_url_with_search(test_case) {
|
||||||
@@ -1709,7 +1713,7 @@ test("navbar_helpers", () => {
|
|||||||
terms: dm_group_including_guest,
|
terms: dm_group_including_guest,
|
||||||
is_common_narrow: true,
|
is_common_narrow: true,
|
||||||
icon: "envelope",
|
icon: "envelope",
|
||||||
title: "translated: alice (guest), joe",
|
title: "translated: alice (guest) and joe",
|
||||||
redirect_url_with_search: "/#narrow/dm/" + joe.user_id + "," + alice.user_id + "-group",
|
redirect_url_with_search: "/#narrow/dm/" + joe.user_id + "," + alice.user_id + "-group",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user