mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
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:
committed by
Tim Abbott
parent
0e55b2aed9
commit
c58f38dae3
@@ -5,6 +5,14 @@ import * as compose_pm_pill from "./compose_pm_pill";
|
||||
let message_type = false; // 'stream', 'private', or false-y
|
||||
let recipient_edited_manually = false;
|
||||
|
||||
// We use this variable to keep track of whether user has viewed the topic resolved
|
||||
// banner for the current compose session, for a narrow. This prevents the banner
|
||||
// from popping up for every keystroke while composing.
|
||||
// The variable is reset on sending a message, closing the compose box and changing
|
||||
// the narrow and the user should still be able to see the banner once after
|
||||
// performing these actions
|
||||
let recipient_viewed_topic_resolved_banner = false;
|
||||
|
||||
export function set_recipient_edited_manually(flag) {
|
||||
recipient_edited_manually = flag;
|
||||
}
|
||||
@@ -21,6 +29,14 @@ export function get_message_type() {
|
||||
return message_type;
|
||||
}
|
||||
|
||||
export function set_recipient_viewed_topic_resolved_banner(flag) {
|
||||
recipient_viewed_topic_resolved_banner = flag;
|
||||
}
|
||||
|
||||
export function has_recipient_viewed_topic_resolved_banner() {
|
||||
return recipient_viewed_topic_resolved_banner;
|
||||
}
|
||||
|
||||
export function recipient_has_topics() {
|
||||
return message_type !== "stream";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user