From 6728ee1f0ee689bfcbcf7587aba4a0c6fb40eacf Mon Sep 17 00:00:00 2001 From: Sean Heckathorne Date: Tue, 23 Aug 2022 04:41:09 -0500 Subject: [PATCH] compose: Clear preview UI when recipient change clears compose box. Previously, we cleared the preview element only when cancelling compose, which meant the compose box would be left in an invalid state, showing a preview from a no longer active draft, if switching recipients with it open. Fix this by moving the call to clear the preview state to clear_box, which is called in both the hide_box (close compose) and change recipient code paths for clearing compose after not having sent a message. Fixes #22703. --- static/js/compose_actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/compose_actions.js b/static/js/compose_actions.js index e76ee2ad8c..603a6ac8b1 100644 --- a/static/js/compose_actions.js +++ b/static/js/compose_actions.js @@ -44,7 +44,6 @@ function hide_box() { compose_fade.clear_compose(); $(".message_comp").hide(); $("#compose_controls").show(); - compose.clear_preview_area(); } function get_focus_area(msg_type, opts) { @@ -111,6 +110,7 @@ function clear_box() { compose.clear_private_stream_alert(); compose_validate.set_user_acknowledged_all_everyone_flag(undefined); + compose.clear_preview_area(); clear_textarea(); compose_validate.check_overflow_text(); $("#compose-textarea").removeData("draft-id");