mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
compose: Show warning while composing to a resolved topic.
This commit creates the function warn_if_topic_resolved that checks if the topic to which the user is composing is resolved or not. First it checks if the stream exists and then if the topic name starts with the RESOLVED_TOPIC_PREFIX. If the conditions are true, a warning banner is shown to the user. It also shows to the user a button to unresolve the topic, if he has the permission to do so. Fixes #20584.
This commit is contained in:
@@ -106,6 +106,7 @@ function clear_box() {
|
||||
compose.clear_invites();
|
||||
|
||||
// TODO: Better encapsulate at-mention warnings.
|
||||
compose_validate.clear_topic_resolved_warning();
|
||||
compose_validate.clear_all_everyone_warnings();
|
||||
compose_validate.clear_announce_warnings();
|
||||
compose.clear_private_stream_alert();
|
||||
@@ -285,6 +286,9 @@ export function start(msg_type, opts) {
|
||||
// Show either stream/topic fields or "You and" field.
|
||||
show_box(msg_type, opts);
|
||||
|
||||
// Show a warning if topic is resolved
|
||||
compose_validate.warn_if_topic_resolved();
|
||||
|
||||
// Reset the `max-height` property of `compose-textarea` so that the
|
||||
// compose-box do not cover the last messages of the current stream
|
||||
// while writing a long message.
|
||||
@@ -460,6 +464,7 @@ export function on_topic_narrow() {
|
||||
// See #3300 for context--a couple users specifically asked for
|
||||
// this convenience.
|
||||
compose_state.topic(narrow_state.topic());
|
||||
compose_validate.warn_if_topic_resolved();
|
||||
compose_fade.set_focused_recipient("stream");
|
||||
compose_fade.update_message_list();
|
||||
$("#compose-textarea").trigger("focus").trigger("select");
|
||||
|
||||
Reference in New Issue
Block a user