From d363ea61587e3dba59f5a0e85f74d5ad7d471aab Mon Sep 17 00:00:00 2001 From: Dinesh Date: Wed, 18 Aug 2021 00:35:14 +0530 Subject: [PATCH] compose: Extract update_on_recipient_change(). Runs when there's a change in recipient fields of compose box. Moved the `update_fade` function to this. This is a preparatory commit to add a feature to go to the narrow you're composing to where we want to update the button visibility when the recipients changes. The update could be run in the function this commit adds. --- static/js/compose.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/static/js/compose.js b/static/js/compose.js index b68170de96..01ced4186d 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -101,6 +101,10 @@ export function update_fade() { compose_fade.update_all(); } +function update_on_recipient_change() { + update_fade(); +} + export function abort_xhr() { $("#compose-send-button").prop("disabled", false); uppy.cancelAll(); @@ -393,10 +397,10 @@ export function initialize() { $("#below-compose-content .video_link").toggle(compute_show_video_chat_button()); $( "#stream_message_recipient_stream,#stream_message_recipient_topic,#private_message_recipient", - ).on("keyup", update_fade); + ).on("keyup", update_on_recipient_change); $( "#stream_message_recipient_stream,#stream_message_recipient_topic,#private_message_recipient", - ).on("change", update_fade); + ).on("change", update_on_recipient_change); $("#compose-textarea").on("keydown", (event) => { compose_ui.handle_keydown(event, $("#compose-textarea").expectOne()); });