Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose: Consider unpilled input in setting attention level.

Karl Stolley1cc453ee8e6e
diff --git a/web/src/compose_recipient.ts b/web/src/compose_recipient.ts
index 187538550d8..cf997a4542c 100644
--- a/web/src/compose_recipient.ts
+++ b/web/src/compose_recipient.ts
@@ -63,6 +63,13 @@ export let update_recipient_row_attention_level = (): void => {
stream_color.adjust_stream_privacy_icon_colors(stream_id, channel_picker_icon_selector);
}
+ // If there is any text that hasn't yet been transformed into a pill,
+ // we should consider that the user is not composing to the current
+ // DM narrow -- even though that input is ignored when sending a DM.
+ // The point here is to avoid a state where we have that input hanging
+ // 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're piggy-backing here, in a roundabout way, on
// compose_ui.set_focus(). Any time the topic or DM recipient
@@ -72,7 +79,8 @@ export let update_recipient_row_attention_level = (): void => {
// logic is handled via the event handlers in compose_setup.js
// that call set_high_attention_recipient_row().
if (
- (composing_to_current_topic_narrow() || composing_to_current_private_message_narrow()) &&
+ (composing_to_current_topic_narrow() ||
+ (composing_to_current_private_message_narrow() && !has_unpilled_input)) &&
compose_state.has_full_recipient()
) {
$("#compose-recipient").toggleClass("low-attention-recipient-row", true);