web-empty-narrow: Update translated banners for stream rename channel.

Updates the translated empty narrow messages in the web app to use
channel instead of stream.

Updates the message view header that has the same text as the empty
narrow when a stream/channel does not exist or the user does not
have access to the stream/channel because it is private.

Part of stream to channel rename project.
This commit is contained in:
Lauryn Menard 2024-04-18 15:16:21 +02:00 committed by Tim Abbott
parent 8bc183e16e
commit 13299577da
3 changed files with 9 additions and 26 deletions

View File

@ -65,7 +65,7 @@ function get_message_view_header_context(filter: Filter | undefined): MessageVie
sub_count: "0",
formatted_sub_count: "0",
rendered_narrow_description: $t({
defaultMessage: "This stream does not exist or is private.",
defaultMessage: "This channel does not exist or is private.",
}),
};
}

View File

@ -112,7 +112,7 @@ function pick_empty_narrow_banner(): NarrowBannerData {
title: default_banner_for_multiple_filters,
html: $t_html({
defaultMessage:
"<p>You are searching for messages that belong to more than one stream, which is not possible.</p>",
"<p>You are searching for messages that belong to more than one channel, which is not possible.</p>",
}),
};
}
@ -264,28 +264,11 @@ function pick_empty_narrow_banner(): NarrowBannerData {
}
if (can_toggle_narrowed_stream()) {
return {
title: $t({
defaultMessage:
"You aren't subscribed to this stream and nobody has talked about that yet!",
}),
// TODO: Consider moving the button to be its own option in the template.
html: $t_html(
{
defaultMessage: "<z-button>Subscribe</z-button>",
},
{
"z-button": (content_html) =>
`<button class="button white rounded stream_sub_unsub_button sea-green" type="button" name="subscription">${content_html.join(
"",
)}</button>`,
},
),
};
return default_banner;
}
return {
title: $t({defaultMessage: "This stream does not exist or is private."}),
title: $t({defaultMessage: "This channel does not exist or is private."}),
};
}
// else fallthrough to default case

View File

@ -222,7 +222,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: This stream does not exist or is private."),
empty_narrow_html("translated: This channel does not exist or is private."),
);
// for non-subbed public stream
@ -232,8 +232,8 @@ run_test("show_empty_narrow_message", ({mock_template}) => {
assert.equal(
$(".empty_feed_notice_main").html(),
empty_narrow_html(
"translated: You aren't subscribed to this stream and nobody has talked about that yet!",
'translated HTML: <button class="button white rounded stream_sub_unsub_button sea-green" type="button" name="subscription">Subscribe</button>',
"translated: There are no messages here.",
'translated HTML: Why not <a href="#" class="empty_feed_compose_stream">start the conversation</a>?',
),
);
@ -524,7 +524,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: This stream does not exist or is private."),
empty_narrow_html("translated: This channel does not exist or is private."),
);
});
@ -626,7 +626,7 @@ run_test("show_invalid_narrow_message", ({mock_template}) => {
$(".empty_feed_notice_main").html(),
empty_narrow_html(
"translated: No search results.",
"translated HTML: <p>You are searching for messages that belong to more than one stream, which is not possible.</p>",
"translated HTML: <p>You are searching for messages that belong to more than one channel, which is not possible.</p>",
),
);