mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 19:06:09 +00:00
compose_validate: Fix buggy separated handling of empty compose box.
When I adjusted 4fbf91c135 to no longer
do a full re-validation on every character typed, that unmasked bugs
in how the compose_setup handler code and compose_validate split
responsibility for validating 0-length messages.
The user-facing result was the send button not enabling properly when
starting to type.
Fix this by moving the 0-length message validation into
compose_validate, where we already handle issues of too-long messages,
sharing the same basic logic for determining when to do a full
validate() call.
A benefit of this reworking is now all of the logic for handling the
`invalid` class is in one place in validate, rather than split with
the compose_setup module.
This commit is contained in:
@@ -77,9 +77,7 @@ export function initialize() {
|
||||
}
|
||||
compose_validate.warn_if_topic_resolved(false);
|
||||
const compose_text_length = compose_validate.check_overflow_text($("#send_message_form"));
|
||||
if (compose_text_length !== 0 && $("textarea#compose-textarea").hasClass("invalid")) {
|
||||
$("textarea#compose-textarea").toggleClass("invalid", false);
|
||||
}
|
||||
|
||||
// Change compose close button tooltip as per condition.
|
||||
// We save compose text in draft only if its length is > 2.
|
||||
if (compose_text_length > 2) {
|
||||
|
||||
Reference in New Issue
Block a user