mirror of
https://github.com/zulip/zulip.git
synced 2026-07-06 21:18:58 +08:00
stream-list: Sort folder sections as per the folder order.
This commit is contained in:
parent
c127a0ae9f
commit
358f67a086
@ -50,6 +50,7 @@ export function add_channel_folder(): void {
|
||||
rendered_description: "",
|
||||
date_created: 0,
|
||||
creator_id: people.my_current_user_id(),
|
||||
order: id,
|
||||
};
|
||||
channel_folders.add(channel_folder);
|
||||
},
|
||||
|
||||
@ -158,6 +158,7 @@ export const channel_folder_schema = z.object({
|
||||
creator_id: z.nullable(z.number()),
|
||||
date_created: z.number(),
|
||||
is_archived: z.boolean(),
|
||||
order: z.number(),
|
||||
});
|
||||
|
||||
export const navigation_view_schema = z.object({
|
||||
|
||||
@ -107,6 +107,7 @@ export type StreamListSection = {
|
||||
streams: number[];
|
||||
muted_streams: number[];
|
||||
inactive_streams: number[]; // Only used for folder sections
|
||||
order?: number; // Only used for folder sections
|
||||
};
|
||||
|
||||
type StreamListSortResult = {
|
||||
@ -164,6 +165,7 @@ export function sort_groups(stream_ids: number[], search_term: string): StreamLi
|
||||
streams: [],
|
||||
muted_streams: [],
|
||||
inactive_streams: [],
|
||||
order: folder.order,
|
||||
};
|
||||
folder_sections.set(sub.folder_id, section);
|
||||
}
|
||||
@ -185,8 +187,8 @@ export function sort_groups(stream_ids: number[], search_term: string): StreamLi
|
||||
}
|
||||
}
|
||||
|
||||
const folder_sections_sorted = [...folder_sections.values()].sort((section_a, section_b) =>
|
||||
util.strcmp(section_a.section_title, section_b.section_title),
|
||||
const folder_sections_sorted = [...folder_sections.values()].sort(
|
||||
(section_a, section_b) => section_a.order! - section_b.order!,
|
||||
);
|
||||
|
||||
// This needs to have the same ordering as the order they're displayed in the sidebar.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user