mirror of https://github.com/zulip/zulip.git
stream_list: Prevent archived channels to show up in left sidebar.
This commit is contained in:
parent
4b90741f91
commit
dbc90ba2e5
|
@ -227,7 +227,8 @@ export function create_initial_sidebar_rows(): void {
|
|||
// This code is slightly opaque, but it ends up building
|
||||
// up list items and attaching them to the "sub" data
|
||||
// structures that are kept in stream_data.js.
|
||||
const subs = stream_data.subscribed_subs();
|
||||
let subs = stream_data.subscribed_subs();
|
||||
subs = subs.filter((sub) => !sub.is_archived);
|
||||
|
||||
for (const sub of subs) {
|
||||
create_sidebar_row(sub);
|
||||
|
@ -689,7 +690,7 @@ export function get_sidebar_stream_topic_info(filter: Filter): {
|
|||
return result;
|
||||
}
|
||||
|
||||
if (!stream_data.is_subscribed(stream_id)) {
|
||||
if (!stream_data.is_subscribed(stream_id) || stream_data.is_stream_archived(stream_id)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,6 +110,9 @@ export function sort_groups(stream_ids: number[], search_term: string): StreamLi
|
|||
const sub = sub_store.get(stream_id);
|
||||
assert(sub);
|
||||
const pinned = sub.pin_to_top;
|
||||
if (sub.is_archived) {
|
||||
continue;
|
||||
}
|
||||
if (pinned) {
|
||||
if (!sub.is_muted) {
|
||||
pinned_streams.push(stream_id);
|
||||
|
|
|
@ -77,6 +77,13 @@ const muted_pinned = {
|
|||
pin_to_top: true,
|
||||
is_muted: true,
|
||||
};
|
||||
const archived = {
|
||||
subscribed: true,
|
||||
name: "archived channel",
|
||||
stream_id: 9,
|
||||
pin_to_top: true,
|
||||
is_archived: true,
|
||||
};
|
||||
|
||||
function sort_groups(query) {
|
||||
const streams = stream_data.subscribed_stream_ids();
|
||||
|
@ -112,6 +119,7 @@ test("basics", ({override_rewire}) => {
|
|||
stream_data.add_sub(stream_hyphen_underscore_slash_colon);
|
||||
stream_data.add_sub(muted_active);
|
||||
stream_data.add_sub(muted_pinned);
|
||||
stream_data.add_sub(archived);
|
||||
|
||||
override_rewire(stream_list_sort, "has_recent_activity", (sub) => sub.name !== "pneumonia");
|
||||
|
||||
|
|
Loading…
Reference in New Issue