compose: Consider unpilled input in setting attention level.

This commit is contained in:
Karl Stolley
2025-08-09 12:54:21 -04:00
committed by Tim Abbott
parent 8a217d8cc7
commit 1cc453ee8e

View File

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