mirror of https://github.com/zulip/zulip.git
stream_list: Fix handling of unsubscribing from last channel.
This check been present since
466beef6fe
, but it seems unnecessary in
that the main logic handles there being 0 channels just fine, that's a
rare case (so not a useful optimization), and importantly, not calling
stream_list_sort.sort_groups for that transition resulted in
`stream_list_sort` having stale data structures, resulting in
exceptions if one tried to open the CHANNELS filter widget in the
newly-no-channels state.
This commit is contained in:
parent
e11cfd7ba8
commit
4ae16b7568
|
@ -241,21 +241,17 @@ export function build_stream_list(force_rerender: boolean): void {
|
||||||
//
|
//
|
||||||
// Within the first two sections, muted streams are sorted to the
|
// Within the first two sections, muted streams are sorted to the
|
||||||
// bottom; we skip that for dormant streams to simplify discovery.
|
// bottom; we skip that for dormant streams to simplify discovery.
|
||||||
const streams = stream_data.subscribed_stream_ids();
|
//
|
||||||
const $parent = $("#stream_filters");
|
|
||||||
if (streams.length === 0) {
|
|
||||||
$parent.empty();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The main logic to build the list is in stream_list_sort.ts, and
|
// The main logic to build the list is in stream_list_sort.ts, and
|
||||||
// we get five lists of streams (pinned/normal/muted_pinned/muted_normal/dormant).
|
// we get five lists of streams (pinned/normal/muted_pinned/muted_normal/dormant).
|
||||||
|
const streams = stream_data.subscribed_stream_ids();
|
||||||
const stream_groups = stream_list_sort.sort_groups(streams, get_search_term());
|
const stream_groups = stream_list_sort.sort_groups(streams, get_search_term());
|
||||||
|
|
||||||
if (stream_groups.same_as_before && !force_rerender) {
|
if (stream_groups.same_as_before && !force_rerender) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const $parent = $("#stream_filters");
|
||||||
const elems = [];
|
const elems = [];
|
||||||
|
|
||||||
function add_sidebar_li(stream_id: number): void {
|
function add_sidebar_li(stream_id: number): void {
|
||||||
|
|
Loading…
Reference in New Issue