From 024932a489b30fa83d7fbcf28b3e1645a3dd061f Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Tue, 22 Nov 2022 14:03:12 +0100 Subject: [PATCH] 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. --- frontend_tests/node_tests/narrow.js | 10 ++++------ static/js/narrow_banner.js | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/frontend_tests/node_tests/narrow.js b/frontend_tests/node_tests/narrow.js index d012cac1bf..ef33fbf178 100644 --- a/frontend_tests/node_tests/narrow.js +++ b/frontend_tests/node_tests/narrow.js @@ -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 start the conversation?', ), ); @@ -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 start the conversation?', ), ); @@ -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 start the conversation?', ), ); @@ -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"]]); diff --git a/static/js/narrow_banner.js b/static/js/narrow_banner.js index 0551e8c521..4d88f6016e 100644 --- a/static/js/narrow_banner.js +++ b/static/js/narrow_banner.js @@ -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.", },