mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
compose: Prevent displaying banner when channel picker is opened.
Prevent displaying the topic resolved banner when the channel picker (compose_select_recipient_dropdown_widget) is opened in the case of forwarding messages. This is done to prevent the overlap of the channel picker and the banner, as it hides some part of the banner text. Fixes: #33449
This commit is contained in:
committed by
Tim Abbott
parent
dadec69986
commit
9ef3a19451
@@ -312,6 +312,8 @@ function on_show_callback(): void {
|
||||
// NOTE: Since tippy triggers this on `mousedown` it is always triggered before say a `click` on `textarea`.
|
||||
function on_hidden_callback(): void {
|
||||
$("#compose_select_recipient_widget").removeClass("widget-open");
|
||||
compose_state.set_is_processing_forward_message(false);
|
||||
compose_validate.warn_if_topic_resolved(false);
|
||||
if (!compose_select_recipient_dropdown_widget.item_clicked) {
|
||||
// If the dropdown was NOT closed due to selecting an item,
|
||||
// don't do anything.
|
||||
|
@@ -256,7 +256,7 @@ export function quote_message(opts: {
|
||||
topic = message.topic;
|
||||
stream_id = message.stream_id;
|
||||
}
|
||||
|
||||
compose_state.set_is_processing_forward_message(true);
|
||||
compose_actions.start({
|
||||
message_type: message.type,
|
||||
topic,
|
||||
|
@@ -74,7 +74,11 @@ export function initialize() {
|
||||
if ($("#compose").hasClass("preview_mode")) {
|
||||
compose.render_preview_area();
|
||||
}
|
||||
compose_validate.warn_if_topic_resolved(false);
|
||||
const recipient_widget_hidden =
|
||||
$(".compose_select_recipient-dropdown-list-container").length === 0;
|
||||
if (recipient_widget_hidden) {
|
||||
compose_validate.warn_if_topic_resolved(false);
|
||||
}
|
||||
const compose_text_length = compose_validate.check_overflow_text($("#send_message_form"));
|
||||
|
||||
// Change compose close button tooltip as per condition.
|
||||
|
@@ -10,6 +10,7 @@ let recipient_edited_manually = false;
|
||||
let is_content_unedited_restored_draft = false;
|
||||
let last_focused_compose_type_input: HTMLTextAreaElement | undefined;
|
||||
let preview_render_count = 0;
|
||||
let is_processing_forward_message = 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
|
||||
@@ -85,6 +86,14 @@ export function set_preview_render_count(count: number): void {
|
||||
preview_render_count = count;
|
||||
}
|
||||
|
||||
export function set_is_processing_forward_message(val: boolean): void {
|
||||
is_processing_forward_message = val;
|
||||
}
|
||||
|
||||
export function get_is_processing_forward_message(): boolean {
|
||||
return is_processing_forward_message;
|
||||
}
|
||||
|
||||
export function composing(): boolean {
|
||||
// This is very similar to get_message_type(), but it returns
|
||||
// a boolean.
|
||||
|
@@ -439,6 +439,17 @@ export function warn_if_topic_resolved(topic_changed: boolean): void {
|
||||
//
|
||||
// Pass topic_changed=true if this function was called in response
|
||||
// to a topic being edited.
|
||||
const recipient_widget_hidden =
|
||||
$(".compose_select_recipient-dropdown-list-container").length === 0;
|
||||
if (compose_state.get_is_processing_forward_message() && recipient_widget_hidden) {
|
||||
// This is for the case of forwarding a message when the
|
||||
// channel picker is opened. There is a possibility that
|
||||
// this banner might be displayed at the same time the
|
||||
// channel picker is opened. We don't want that situation.
|
||||
// Therefore, we are preventing the display of this
|
||||
// banner when the channel picker is opened.
|
||||
return;
|
||||
}
|
||||
|
||||
const stream_id = compose_state.stream_id();
|
||||
if (stream_id === undefined) {
|
||||
|
Reference in New Issue
Block a user