web-compose-warnings: Update banners for stream rename channel.

Updates warning string when linking to a private stream/channel when
composing a message in the web app to use channel instead of stream.

Updates error banner when using a stream/channel wildcard mention
when composing a message in the web app to use channel instead of
stream.

Part of stream to channel rename project.
This commit is contained in:
Lauryn Menard 2024-04-19 13:20:33 +02:00 committed by Tim Abbott
parent ff98758ed0
commit 36e00308b8
4 changed files with 7 additions and 7 deletions

View File

@ -187,7 +187,7 @@ export function warn_if_private_stream_is_linked(
const new_row_html = render_private_stream_warning({
stream_id: linked_stream.stream_id,
banner_type: compose_banner.WARNING,
stream_name: linked_stream.name,
channel_name: linked_stream.name,
classname: compose_banner.CLASSNAMES.private_stream_warning,
});
compose_banner.append_compose_banner_to_banner_list($(new_row_html), $banner_container);
@ -514,7 +514,7 @@ export function validate_stream_message_mentions(opts: StreamWildcardOptions): b
const new_row_html = render_wildcard_mention_not_allowed_error({
banner_type: compose_banner.ERROR,
classname: compose_banner.CLASSNAMES.wildcards_not_allowed,
stream_wildcard_mention: opts.stream_wildcard_mention,
wildcard_mention_string: opts.stream_wildcard_mention,
});
compose_banner.append_compose_banner_to_banner_list(
$(new_row_html),

View File

@ -1,5 +1,5 @@
{{#> compose_banner }}
<p class="banner_message">
{{#tr}}Warning: <strong>#{stream_name}</strong> is a private stream.{{/tr}}
{{#tr}}Warning: <strong>#{channel_name}</strong> is a private channel.{{/tr}}
</p>
{{/compose_banner}}

View File

@ -1,7 +1,7 @@
{{#> compose_banner }}
<p class="banner_message">
{{#if stream_wildcard_mention}}
{{#tr}}You do not have permission to use <b>@{stream_wildcard_mention}</b> mentions in this stream.{{/tr}}
{{#if wildcard_mention_string}}
{{#tr}}You do not have permission to use <b>@{wildcard_mention_string}</b> mentions in this channel.{{/tr}}
{{else}}
{{#tr}}You do not have permission to use <b>@topic</b> mentions in this topic.{{/tr}}
{{/if}}

View File

@ -395,7 +395,7 @@ test_ui("validate_stream_message", ({override_rewire, mock_template}) => {
let wildcards_not_allowed_rendered = false;
mock_template("compose_banner/wildcard_mention_not_allowed_error.hbs", false, (data) => {
assert.equal(data.classname, compose_banner.CLASSNAMES.wildcards_not_allowed);
assert.equal(data.stream_wildcard_mention, "all");
assert.equal(data.wildcard_mention_string, "all");
wildcards_not_allowed_rendered = true;
return "<banner-stub>";
});
@ -627,7 +627,7 @@ test_ui("warn_if_private_stream_is_linked", ({mock_template}) => {
let banner_rendered = false;
mock_template("compose_banner/private_stream_warning.hbs", false, (data) => {
assert.equal(data.classname, compose_banner.CLASSNAMES.private_stream_warning);
assert.equal(data.stream_name, "Denmark");
assert.equal(data.channel_name, "Denmark");
banner_rendered = true;
return "<banner-stub>";
});