Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose_banner: Reword no channel selected banner error.

Apoorva Pendse979b4203c745
diff --git a/tools/i18n/update-for-legacy-translations b/tools/i18n/update-for-legacy-translations
index e47814b05d4..c3e22fa4843 100755
--- a/tools/i18n/update-for-legacy-translations
+++ b/tools/i18n/update-for-legacy-translations
@@ -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",
diff --git a/web/src/compose_validate.ts b/web/src/compose_validate.ts
index d56c3fe89c5..d3e194a8527 100644
--- a/web/src/compose_validate.ts
+++ b/web/src/compose_validate.ts
@@ -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"),
diff --git a/web/tests/compose_validate.test.cjs b/web/tests/compose_validate.test.cjs
index 05efdf76793..a7fc11acf4d 100644
--- a/web/tests/compose_validate.test.cjs
+++ b/web/tests/compose_validate.test.cjs
@@ -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>";
});