From ff8d209807bdb6422b84597e57c526ad0eb3a296 Mon Sep 17 00:00:00 2001 From: N-Shar-ma Date: Tue, 25 Apr 2023 04:37:48 +0530 Subject: [PATCH] compose: Add utility function to clear all compose banners. --- web/src/compose_banner.ts | 4 ++++ web/src/hotkey.js | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/web/src/compose_banner.ts b/web/src/compose_banner.ts index f28ee239e7..8ab8e643ec 100644 --- a/web/src/compose_banner.ts +++ b/web/src/compose_banner.ts @@ -65,6 +65,10 @@ export function clear_warnings(): void { $(`#compose_banners .${CSS.escape(WARNING)}`).remove(); } +export function clear_all(): void { + $(`#compose_banners`).empty(); +} + export function show_error_message(message: string, classname: string, $bad_input?: JQuery): void { $(`#compose_banners .${CSS.escape(classname)}`).remove(); diff --git a/web/src/hotkey.js b/web/src/hotkey.js index 759f12538b..194ec50449 100644 --- a/web/src/hotkey.js +++ b/web/src/hotkey.js @@ -310,9 +310,7 @@ export function process_escape_key(e) { // Check for errors in compose box; close errors if they exist if ($(".compose_banner").length) { - compose_banner.clear_message_sent_banners(); - compose_banner.clear_errors(); - compose_banner.clear_warnings(); + compose_banner.clear_all(); return true; }