diff --git a/web/src/stream_list.ts b/web/src/stream_list.ts index c7f7076f59..c4e4f34ec0 100644 --- a/web/src/stream_list.ts +++ b/web/src/stream_list.ts @@ -284,10 +284,10 @@ export function rewire_stream_list_section_container_html( } function get_section_channel_plus_icon_url(section: StreamListSection): string | undefined { - if (section.id === "normal-streams") { + if (section.folder_id !== null) { + return `#channels/folders/${section.folder_id}/new`; + } else if (section.id === "normal-streams") { return "#channels/new"; - } else if (section.id !== "pinned-streams") { - return `#channels/folders/${section.id}/new`; } return undefined; } diff --git a/web/src/stream_list_sort.ts b/web/src/stream_list_sort.ts index 0d3458cfb8..fdf58b7eb5 100644 --- a/web/src/stream_list_sort.ts +++ b/web/src/stream_list_sort.ts @@ -103,6 +103,7 @@ export function has_recent_activity(sub: StreamSubscription): boolean { export type StreamListSection = { id: string; + folder_id: number | null; section_title: string; streams: number[]; muted_streams: number[]; @@ -128,6 +129,7 @@ export function sort_groups(stream_ids: number[], search_term: string): StreamLi const pinned_section: StreamListSection = { id: "pinned-streams", + folder_id: null, section_title: $t({defaultMessage: "PINNED CHANNELS"}), streams: [], muted_streams: [], @@ -135,6 +137,7 @@ export function sort_groups(stream_ids: number[], search_term: string): StreamLi }; const normal_section: StreamListSection = { id: "normal-streams", + folder_id: null, section_title: $t({defaultMessage: "CHANNELS"}), streams: [], muted_streams: [], @@ -161,6 +164,7 @@ export function sort_groups(stream_ids: number[], search_term: string): StreamLi if (!section) { section = { id: sub.folder_id.toString(), + folder_id: sub.folder_id, section_title: folder.name.toUpperCase(), streams: [], muted_streams: [], diff --git a/web/tests/stream_list_sort.test.cjs b/web/tests/stream_list_sort.test.cjs index 0d7b1d31fd..501556273b 100644 --- a/web/tests/stream_list_sort.test.cjs +++ b/web/tests/stream_list_sort.test.cjs @@ -103,6 +103,7 @@ test("no_subscribed_streams", () => { sections: [ { id: "pinned-streams", + folder_id: null, inactive_streams: [], muted_streams: [], section_title: "translated: PINNED CHANNELS", @@ -110,6 +111,7 @@ test("no_subscribed_streams", () => { }, { id: "normal-streams", + folder_id: null, inactive_streams: [], muted_streams: [], section_title: "translated: CHANNELS",