Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose_recipient: Guard DM validation with message type check.
Aman Agrawal6ff5a2e3cd59
diff --git a/web/src/compose_recipient.ts b/web/src/compose_recipient.tsindex 6e05c6b1a55..fb226eeae8c 100644--- a/web/src/compose_recipient.ts+++ b/web/src/compose_recipient.ts@@ -51,6 +51,9 @@ function composing_to_current_topic_narrow(): boolean {}function composing_to_current_private_message_narrow(): boolean {+ if (compose_state.get_message_type() !== "private") {+ return false;+ }const compose_state_recipient = new Set(compose_state.private_message_recipient_ids());const narrow_state_recipient = narrow_state.pm_ids_set();if (narrow_state_recipient.size === 0) {@@ -83,7 +86,9 @@ export let update_recipient_row_attention_level = (): void => {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);+ const message_type = compose_state.get_message_type();+ const is_valid_dm =+ message_type === "private" && compose_validate.validate_private_message(false);// It is possible that focus can remain in the recipient row while// narrowing, e.g., with the `Ctrl + .` shortcut. We should account// for that in the logic below, so that we don't erroneously add