Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose: Preserve high-attention row on invalid DMs.
Karl Stolley66f942f1c459
diff --git a/web/src/compose_recipient.ts b/web/src/compose_recipient.tsindex cf997a4542c..b329628ca8d 100644--- a/web/src/compose_recipient.ts+++ b/web/src/compose_recipient.ts@@ -70,6 +70,9 @@ export let update_recipient_row_attention_level = (): void => {// around on a low-attention recipient row, which can also happen when// the DM-recipient typeahead is open.const has_unpilled_input = $("#private_message_recipient").text().length > 0;+ // We also want to watch out for cases where the DM isn't valid,+ // as when trying to message deactivated users.+ const is_valid_dm = compose_validate.validate_private_message(false);// We're piggy-backing here, in a roundabout way, on// compose_ui.set_focus(). Any time the topic or DM recipient@@ -80,7 +83,9 @@ export let update_recipient_row_attention_level = (): void => {// that call set_high_attention_recipient_row().if ((composing_to_current_topic_narrow() ||- (composing_to_current_private_message_narrow() && !has_unpilled_input)) &&+ (composing_to_current_private_message_narrow() &&+ !has_unpilled_input &&+ is_valid_dm)) &&compose_state.has_full_recipient()) {$("#compose-recipient").toggleClass("low-attention-recipient-row", true);diff --git a/web/src/compose_validate.ts b/web/src/compose_validate.tsindex 44c5ae0031e..d0410230b27 100644--- a/web/src/compose_validate.ts+++ b/web/src/compose_validate.ts@@ -941,7 +941,7 @@ function validate_stream_message(scheduling_message: boolean, show_banner = true// The function checks whether the recipients are users of the realm or cross realm users (bots// for now)-function validate_private_message(show_banner = true): boolean {+export function validate_private_message(show_banner = true): boolean {const user_ids = compose_pm_pill.get_user_ids();const user_ids_string = util.sorted_ids(user_ids).join(",");const $banner_container = $("#compose_banners");