mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 02:48:00 +00:00
compose-closed: Fix updating buttons when not in DM narrow.
When processing a server event or an empty message fetch, we were incorrectly updating the closed new conversation button attribute, "data-conversation-type" to be "direct" without checking to see if the current narrow filter was actually a direct message view. Adds a helper function that checks the current filter for contains_only_private_messages and then calls compose_closed_ui.update_buttons_for_private when true. That's the same check that's used in message_view.handle_post_view_change when compose_closed_ui.update_buttons_for_private is called, so we're consistently using the same check when updating the closed compose box buttons for this state.
This commit is contained in:
committed by
Tim Abbott
parent
c1480bec36
commit
1c7e4a5e09
@@ -208,6 +208,13 @@ export function update_buttons_for_non_specific_views(): void {
|
|||||||
set_standard_text_for_reply_button();
|
set_standard_text_for_reply_button();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function maybe_update_buttons_for_dm_recipient(): void {
|
||||||
|
const filter = narrow_state.filter();
|
||||||
|
if (filter?.contains_only_private_messages()) {
|
||||||
|
update_buttons_for_private();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function set_reply_button_label(label: string): void {
|
function set_reply_button_label(label: string): void {
|
||||||
$("#left_bar_compose_reply_button_big").text(label);
|
$("#left_bar_compose_reply_button_big").text(label);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ export function fetch_more_if_required_for_current_msg_list(
|
|||||||
// no messages to display in this narrow.
|
// no messages to display in this narrow.
|
||||||
narrow_banner.show_empty_narrow_message(message_lists.current.data.filter);
|
narrow_banner.show_empty_narrow_message(message_lists.current.data.filter);
|
||||||
message_lists.current.update_trailing_bookend();
|
message_lists.current.update_trailing_bookend();
|
||||||
compose_closed_ui.update_buttons_for_private();
|
compose_closed_ui.maybe_update_buttons_for_dm_recipient();
|
||||||
compose_recipient.check_posting_policy_for_compose_box();
|
compose_recipient.check_posting_policy_for_compose_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ export function dispatch_normal_event(event) {
|
|||||||
key === "direct_message_permission_group"
|
key === "direct_message_permission_group"
|
||||||
) {
|
) {
|
||||||
settings_org.check_disable_direct_message_initiator_group_widget();
|
settings_org.check_disable_direct_message_initiator_group_widget();
|
||||||
compose_closed_ui.update_buttons_for_private();
|
compose_closed_ui.maybe_update_buttons_for_dm_recipient();
|
||||||
compose_recipient.check_posting_policy_for_compose_box();
|
compose_recipient.check_posting_policy_for_compose_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user