message_feed: Hide compose banner when unsubbing from stream.

Currently, when a user marks messages as unread in a stream/topic
and unsubscribes from the stream, both subscribe button and compose
banner will remain visible. This change will hide the compose banner
when the user unsubscribes from the stream and hopes to create a
better flow and reduce confusion.
This commit is contained in:
Joelute 2023-02-13 19:58:49 -05:00 committed by Tim Abbott
parent dcd8947c1b
commit b2b86b5e6f
2 changed files with 7 additions and 0 deletions

View File

@ -167,7 +167,13 @@ export function mark_unsubscribed(sub) {
}
if (narrow_state.is_for_stream_id(sub.stream_id)) {
// Update UI components if we just unsubscribed from the
// currently viewed stream.
message_lists.current.update_trailing_bookend();
// This update would likely be better implemented by having it
// disappear whenever no unread messages remain.
unread_ui.hide_mark_as_read_turned_off_banner();
}
// Unread messages in the now-unsubscribe stream need to be

View File

@ -401,6 +401,7 @@ test("mark_unsubscribed (render_title_area)", ({override}) => {
override(stream_list, "remove_sidebar_row", noop);
override(stream_list, "update_subscribe_to_more_streams_link", noop);
override(unread_ui, "update_unread_counts", noop);
override(unread_ui, "hide_mark_as_read_turned_off_banner", noop);
stream_events.mark_unsubscribed(sub);