mirror of https://github.com/zulip/zulip.git
compose: Avoid showing empty msg error when send by enter is enabled.
We are doing this to avoid annoying behavior, when "enter sends" is enabled, and the user accidentally hits "Enter" and has to deal with the error message. Fixes #19182
This commit is contained in:
parent
0dbc7e0d21
commit
801ebba7c7
|
@ -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}) => {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue