compose: Replace empty message banner with red outline for compose box.

Previously, we showed an empty message banner if the user tried
to send an empty message. We only showed it for users with
"ctrl+enter to send" because we thought it might be easy for a
user to press just enter accidentally.

However, this missed the case where the user clicks on the Enter
button. We want to show the user something in this case to tell
them that they're missing message content.

To avoid more complicated logic, this PR removes the banner
completely and changes the compose box border to red if the
user tries to send an empty message (for all cases).

The red line goes away as soon as the composebox has non-whitespace
characters.
This commit is contained in:
evykassirer
2023-01-03 00:35:18 -08:00
committed by Tim Abbott
parent 631ca13428
commit 541d3ffa06
7 changed files with 28 additions and 22 deletions

View File

@@ -445,6 +445,9 @@ export function initialize() {
$("#compose-textarea").on("input propertychange", () => {
compose_validate.warn_if_topic_resolved(false);
const compose_text_length = compose_validate.check_overflow_text();
if (compose_text_length !== 0 && $("#compose-textarea").hasClass("invalid")) {
$("#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) {