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:
Lauryn Menard
2025-09-03 15:43:09 +02:00
committed by Tim Abbott
parent c1480bec36
commit 1c7e4a5e09
3 changed files with 9 additions and 2 deletions

View File

@@ -128,7 +128,7 @@ export function fetch_more_if_required_for_current_msg_list(
// no messages to display in this narrow.
narrow_banner.show_empty_narrow_message(message_lists.current.data.filter);
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();
}