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.
This commit is contained in:
Dinesh 2021-08-18 00:35:14 +05:30 committed by Tim Abbott
parent 299995bd3a
commit d363ea6158
1 changed files with 6 additions and 2 deletions

View File

@ -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());
});