refactor: Move "send button" related code from compose_validate.js.

This commit moves "send button" related code from
`compose_validate.js` to `compose.js` as it makes more
sense there.
This commit is contained in:
Riken Shah
2021-07-13 19:25:31 +00:00
committed by Tim Abbott
parent 2e4a333133
commit 644cd18dfd
4 changed files with 41 additions and 35 deletions

View File

@@ -266,6 +266,11 @@ export function enter_with_preview_open() {
}
}
function show_sending_indicator(whats_happening) {
$("#sending-indicator").text(whats_happening);
$("#sending-indicator").show();
}
export function finish() {
clear_preview_area();
clear_invites();
@@ -283,6 +288,12 @@ export function finish() {
return undefined;
}
$("#compose-send-button").prop("disabled", true).trigger("blur");
if (reminder.is_deferred_delivery(message_content)) {
show_sending_indicator($t({defaultMessage: "Scheduling..."}));
} else {
show_sending_indicator($t({defaultMessage: "Sending..."}));
}
if (!compose_validate.validate()) {
// If the message failed validation, hide the sending indicator.
$("#sending-indicator").hide();