mirror of https://github.com/zulip/zulip.git
compose validate: Rename overflow verifier.
This makes it clearer what the return value means.
This commit is contained in:
parent
b406cc84ff
commit
83b484db32
|
@ -598,7 +598,7 @@ export function check_overflow_text() {
|
|||
return text.length;
|
||||
}
|
||||
|
||||
export function warn_for_text_overflow_when_tries_to_send() {
|
||||
export function validate_message_length() {
|
||||
if (compose_state.message_content().length > page_params.max_message_length) {
|
||||
$("#compose-textarea").addClass("flash");
|
||||
setTimeout(() => $("#compose-textarea").removeClass("flash"), 1500);
|
||||
|
@ -624,7 +624,7 @@ export function validate() {
|
|||
);
|
||||
return false;
|
||||
}
|
||||
if (!warn_for_text_overflow_when_tries_to_send()) {
|
||||
if (!validate_message_length()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ function handle_keydown(e) {
|
|||
if (should_enter_send(e)) {
|
||||
e.preventDefault();
|
||||
if (
|
||||
compose_validate.warn_for_text_overflow_when_tries_to_send() &&
|
||||
compose_validate.validate_message_length() &&
|
||||
!$("#compose-send-button").prop("disabled")
|
||||
) {
|
||||
compose.finish();
|
||||
|
|
|
@ -13,7 +13,7 @@ const compose = mock_esm("../src/compose", {
|
|||
finish: noop,
|
||||
});
|
||||
const compose_validate = mock_esm("../src/compose_validate", {
|
||||
warn_for_text_overflow_when_tries_to_send: () => true,
|
||||
validate_message_length: () => true,
|
||||
});
|
||||
const input_pill = mock_esm("../src/input_pill");
|
||||
const message_user_ids = mock_esm("../src/message_user_ids", {
|
||||
|
|
Loading…
Reference in New Issue