stream_list: Add folder ids to StreamListSection object.

Followup to
https://github.com/zulip/zulip/pull/35075#discussion_r2232041259
This commit is contained in:
Evy Kassirer
2025-08-07 20:05:07 -07:00
committed by Tim Abbott
parent 8817284f7a
commit a644874e76
3 changed files with 9 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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: [],

View File

@@ -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",