Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

streams: Fix notice appears even when the panel is not empty.

brijsiyag0c30acbe3907
diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.js
index 42e230e8a9d..e521e7e2982 100644
--- a/web/src/server_events_dispatch.js
+++ b/web/src/server_events_dispatch.js
@@ -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);
}
diff --git a/web/src/stream_settings_ui.js b/web/src/stream_settings_ui.js
index 52492c8e6ed..14a5578c206 100644
--- a/web/src/stream_settings_ui.js
+++ b/web/src/stream_settings_ui.js
@@ -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;
}