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.

stream_list_sort: Minor refactor.

Aman Agrawal27c6a963e505
diff --git a/web/src/stream_list_sort.ts b/web/src/stream_list_sort.ts
index 69eab0a4f39..d6b83e6860f 100644
--- a/web/src/stream_list_sort.ts
+++ b/web/src/stream_list_sort.ts
@@ -114,6 +114,23 @@ export function sort_groups(
all_subscribed_stream_ids: number[],
search_term: string,
): StreamListSortResult {
+ const pinned_section: StreamListSection = {
+ id: "pinned-streams",
+ folder_id: null,
+ section_title: $t({defaultMessage: "PINNED CHANNELS"}),
+ streams: [],
+ muted_streams: [],
+ inactive_streams: [],
+ };
+ const normal_section: StreamListSection = {
+ id: "normal-streams",
+ folder_id: null,
+ section_title: $t({defaultMessage: "CHANNELS"}),
+ streams: [],
+ muted_streams: [],
+ inactive_streams: [],
+ };
+
const stream_id_to_name = (stream_id: number): string => sub_store.get(stream_id)!.name;
// Use -, _, : and / as word separators apart from the default space character
const word_separator_regex = /[\s/:_-]/;
@@ -152,23 +169,6 @@ export function sort_groups(
];
}
- const pinned_section: StreamListSection = {
- id: "pinned-streams",
- folder_id: null,
- section_title: $t({defaultMessage: "PINNED CHANNELS"}),
- streams: [],
- muted_streams: [],
- inactive_streams: [],
- };
- const normal_section: StreamListSection = {
- id: "normal-streams",
- folder_id: null,
- section_title: $t({defaultMessage: "CHANNELS"}),
- streams: [],
- muted_streams: [],
- inactive_streams: [],
- };
-
const folder_sections = new Map<number, StreamListSection>();
for (const stream_id of matching_stream_ids) {