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: Show topic required error if topic is "(no topic)".

Sahil Batracbac4666589f
diff --git a/frontend_tests/node_tests/compose_validate.js b/frontend_tests/node_tests/compose_validate.js
index 69defae816d..04bb3a6a656 100644
--- a/frontend_tests/node_tests/compose_validate.js
+++ b/frontend_tests/node_tests/compose_validate.js
@@ -247,6 +247,13 @@ test_ui("validate", ({override, mock_template}) => {
$("#compose-error-msg").html(),
$t_html({defaultMessage: "Topics are required in this organization"}),
);
+
+ compose_state.topic("(no topic)");
+ assert.ok(!compose_validate.validate());
+ assert.equal(
+ $("#compose-error-msg").html(),
+ $t_html({defaultMessage: "Topics are required in this organization"}),
+ );
});
test_ui("get_invalid_recipient_emails", ({override_rewire}) => {
diff --git a/static/js/compose_validate.js b/static/js/compose_validate.js
index 40586d77163..1db3240b629 100644
--- a/static/js/compose_validate.js
+++ b/static/js/compose_validate.js
@@ -524,7 +524,9 @@ function validate_stream_message() {
if (page_params.realm_mandatory_topics) {
const topic = compose_state.topic();
- if (topic === "") {
+ // TODO: We plan to migrate the empty topic to only using the
+ // `""` representation for i18n reasons, but have not yet done so.
+ if (topic === "" || topic === "(no topic)") {
compose_error.show(
$t_html({defaultMessage: "Topics are required in this organization"}),
$("#stream_message_recipient_topic"),