compose: Show resolve topic banner only once per narrow.

Previously, when sending a message to a resolved topic, if you disissed
the 'You are sending a message to a resolved topic' banner, it would
reappear as soon as the user enters another character.

Fix this by showing the banner at most once per narrow. It does not
reappear if the user closes the banner and continues typing.  It will
only be shown again if the user closes compose, changes stream/topic,
sends a message or otherwise clears the compose box state.

We also remove the existing check for whether this banner is already
visible; this is essentially a more precise version of the same logic.

Fixes #24245.
This commit is contained in:
Pranav2612000
2023-02-02 10:13:24 +05:30
committed by Tim Abbott
parent 0e55b2aed9
commit c58f38dae3
5 changed files with 39 additions and 2 deletions

View File

@@ -96,6 +96,11 @@ function update_fade() {
}
const msg_type = compose_state.get_message_type();
// It's possible that the new topic is not a resolved topic
// so we clear the older warning.
compose_validate.clear_topic_resolved_warning();
compose_validate.warn_if_topic_resolved();
compose_fade.set_focused_recipient(msg_type);
compose_fade.update_all();