narrow-banner: Fix empty narrow banner titles with user's full name.

Fixes an issue introduced in 6b4ab21 when we started using the
user's full name for empty narrow titles in a single operator
narrow of either "pm-with", "group-pm-with" or "sender".

For these empty narrow titles, any ', & or < characters in the
user's full name are not escaped.
This commit is contained in:
Lauryn Menard 2022-11-22 14:03:12 +01:00 committed by Tim Abbott
parent 1698778145
commit 024932a489
2 changed files with 7 additions and 9 deletions

View File

@ -388,7 +388,7 @@ run_test("show_empty_narrow_message", ({mock_template}) => {
assert.equal(
$(".empty_feed_notice_main").html(),
empty_narrow_html(
"translated HTML: You have no private messages with Example Bot yet.",
"translated: You have no private messages with Example Bot yet.",
'translated HTML: Why not <a href="#" class="empty_feed_compose_private">start the conversation</a>?',
),
);
@ -414,7 +414,7 @@ run_test("show_empty_narrow_message", ({mock_template}) => {
assert.equal(
$(".empty_feed_notice_main").html(),
empty_narrow_html(
"translated HTML: You have no private messages with Alice Smith yet.",
"translated: You have no private messages with Alice Smith yet.",
'translated HTML: Why not <a href="#" class="empty_feed_compose_private">start the conversation</a>?',
),
);
@ -487,7 +487,7 @@ run_test("show_empty_narrow_message", ({mock_template}) => {
assert.equal(
$(".empty_feed_notice_main").html(),
empty_narrow_html(
"translated HTML: You have no group private messages with Alice Smith yet.",
"translated: You have no group private messages with Alice Smith yet.",
'translated HTML: Why not <a href="#" class="empty_feed_compose_private">start the conversation</a>?',
),
);
@ -497,9 +497,7 @@ run_test("show_empty_narrow_message", ({mock_template}) => {
narrow_banner.show_empty_narrow_message();
assert.equal(
$(".empty_feed_notice_main").html(),
empty_narrow_html(
"translated HTML: You haven't received any messages sent by Raymond yet.",
),
empty_narrow_html("translated: You haven't received any messages sent by Raymond yet."),
);
set_filter([["sender", "sinwar@example.com"]]);

View File

@ -328,7 +328,7 @@ function pick_empty_narrow_banner() {
};
}
return {
title: $t_html(
title: $t(
{
defaultMessage: "You have no private messages with {person} yet.",
},
@ -366,7 +366,7 @@ function pick_empty_narrow_banner() {
const sender = people.get_by_email(first_operand);
if (sender) {
return {
title: $t_html(
title: $t(
{
defaultMessage:
"You haven't received any messages sent by {person} yet.",
@ -398,7 +398,7 @@ function pick_empty_narrow_banner() {
};
}
return {
title: $t_html(
title: $t(
{
defaultMessage: "You have no group private messages with {person} yet.",
},