mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
streams: Fix notice appears even when the panel is not empty.
This fixes regression in 55bd3220b6,
Where notice gets rendered even when there are streams shown in panel.
Now the check var to render message conditionally checks for both
`subscribed` and `all streams` tabs. We are avoiding the fully use of DOM
in this context because if the filter results in no stream, then also
it will display a notice. Also this commits swaps order of calling
`stream_data.delete_sub()` and `stream_settings_ui.remove_stream()`
functions in server_events_dispatch because `update_empty_left_panel_message`
uses stream_data, which was giving outdated data.
This commit is contained in:
@@ -490,8 +490,8 @@ export function dispatch_normal_event(event) {
|
||||
const is_narrowed_to_stream = narrow_state.is_for_stream_id(
|
||||
stream.stream_id,
|
||||
);
|
||||
stream_settings_ui.remove_stream(stream.stream_id);
|
||||
stream_data.delete_sub(stream.stream_id);
|
||||
stream_settings_ui.remove_stream(stream.stream_id);
|
||||
if (was_subscribed) {
|
||||
stream_list.remove_sidebar_row(stream.stream_id);
|
||||
}
|
||||
|
||||
@@ -445,11 +445,20 @@ export function render_left_panel_superset() {
|
||||
}
|
||||
|
||||
export function update_empty_left_panel_message() {
|
||||
// Check if we have any subscribed streams to decide whether to
|
||||
// Check if we have any streams in panel to decide whether to
|
||||
// display a notice.
|
||||
const has_subscribed_streams = stream_data.subscribed_subs().length > 0;
|
||||
|
||||
if (has_subscribed_streams) {
|
||||
let has_streams;
|
||||
if (is_subscribed_stream_tab_active()) {
|
||||
// We don't remove stream row from UI on unsubscribe, To handle
|
||||
// this case here we are also checking DOM if there are streams
|
||||
// displayed in panel or not.
|
||||
has_streams =
|
||||
stream_data.subscribed_subs().length ||
|
||||
$("#manage_streams_container .stream-row:not(.notdisplayed)").length;
|
||||
} else {
|
||||
has_streams = stream_data.get_unsorted_subs().length;
|
||||
}
|
||||
if (has_streams) {
|
||||
$(".no-streams-to-show").hide();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user