compose_banner: Reword no channel selected banner error.

Preparatory commit for #32115.
This commit is contained in:
Apoorva Pendse
2025-01-25 12:51:55 +05:30
committed by Tim Abbott
parent 4b82e08b13
commit 979b4203c7
3 changed files with 6 additions and 4 deletions

View File

@@ -97,7 +97,7 @@ LEGACY_STRINGS_MAP = {
"Only subscribers to this channel can edit channel permissions.": "Only subscribers to this stream can edit stream permissions.",
"Pin channel to top": "Pin stream to top",
"Pin channel to top of left sidebar": "Pin stream to top of left sidebar",
"Please specify a channel.": "Please specify a stream.",
"Please select a channel.": "Please specify a stream.",
"Private channels cannot be default channels for new users.": "Private streams cannot be default streams for new users.",
"Receives new channel announcements": "Receives new stream announcements",
"Require topics in channel messages": "Require topics in stream messages",

View File

@@ -39,6 +39,7 @@ let recipient_disallowed = false;
export const NO_PRIVATE_RECIPIENT_ERROR_MESSAGE = $t({
defaultMessage: "Please add a valid recipient.",
});
export const NO_CHANNEL_SELECTED_ERROR_MESSAGE = $t({defaultMessage: "Please select a channel."});
type StreamWildcardOptions = {
stream_id: number;
@@ -653,9 +654,10 @@ export function validate_stream_message_address_info(sub: StreamSubscription): b
function validate_stream_message(scheduling_message: boolean): boolean {
const stream_id = compose_state.stream_id();
const $banner_container = $("#compose_banners");
if (stream_id === undefined) {
const no_channel_selected = stream_id === undefined;
if (no_channel_selected) {
compose_banner.show_error_message(
$t({defaultMessage: "Please specify a channel."}),
NO_CHANNEL_SELECTED_ERROR_MESSAGE,
compose_banner.CLASSNAMES.missing_stream,
$banner_container,
$("#compose_select_recipient_widget_wrapper"),

View File

@@ -322,7 +322,7 @@ test_ui("validate", ({mock_template, override}) => {
let empty_stream_error_rendered = false;
mock_template("compose_banner/compose_banner.hbs", false, (data) => {
assert.equal(data.classname, compose_banner.CLASSNAMES.missing_stream);
assert.equal(data.banner_text, $t({defaultMessage: "Please specify a channel."}));
assert.equal(data.banner_text, compose_validate.NO_CHANNEL_SELECTED_ERROR_MESSAGE);
empty_stream_error_rendered = true;
return "<banner-stub>";
});