Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose: Avoid showing empty msg error when send by enter is enabled.
Riken Shah801ebba7c7f8
diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.jsindex 4c874832219..5045d060c0f 100644--- a/frontend_tests/node_tests/compose.js+++ b/frontend_tests/node_tests/compose.js@@ -518,10 +518,7 @@ test_ui("enter_with_preview_open", ({override}) => {compose.enter_with_preview_open();assert.ok($("#enter_sends").prop("checked"));- assert.equal(- $("#compose-error-msg").html(),- $t_html({defaultMessage: "You have nothing to send!"}),- );+ assert.equal($("#compose-error-msg").html(), "never-been-set");});test_ui("finish", ({override}) => {diff --git a/static/js/compose_validate.js b/static/js/compose_validate.jsindex 948b8f3eaec..cc612a3d62b 100644--- a/static/js/compose_validate.js+++ b/static/js/compose_validate.js@@ -522,10 +522,14 @@ export function validate() {}if (/^\s*$/.test(message_content)) {- compose_error.show(- $t_html({defaultMessage: "You have nothing to send!"}),- $("#compose-textarea"),- );+ // Avoid showing an error message when "enter sends" is enabled,+ // as it is more likely that the user has hit "Enter" accidentally.+ if (!page_params.enter_sends) {+ compose_error.show(+ $t_html({defaultMessage: "You have nothing to send!"}),+ $("#compose-textarea"),+ );+ }return false;}