diff --git a/web/src/compose_validate.js b/web/src/compose_validate.js index d7266e23d3..fca355d940 100644 --- a/web/src/compose_validate.js +++ b/web/src/compose_validate.js @@ -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; } diff --git a/web/src/composebox_typeahead.js b/web/src/composebox_typeahead.js index f21dbcaa68..6a2e0f2f74 100644 --- a/web/src/composebox_typeahead.js +++ b/web/src/composebox_typeahead.js @@ -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(); diff --git a/web/tests/composebox_typeahead.test.js b/web/tests/composebox_typeahead.test.js index 9dc6893d28..02fb9f7af3 100644 --- a/web/tests/composebox_typeahead.test.js +++ b/web/tests/composebox_typeahead.test.js @@ -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", {