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 { 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"; return "#channels/new";
} else if (section.id !== "pinned-streams") {
return `#channels/folders/${section.id}/new`;
} }
return undefined; return undefined;
} }

View File

@@ -103,6 +103,7 @@ export function has_recent_activity(sub: StreamSubscription): boolean {
export type StreamListSection = { export type StreamListSection = {
id: string; id: string;
folder_id: number | null;
section_title: string; section_title: string;
streams: number[]; streams: number[];
muted_streams: number[]; muted_streams: number[];
@@ -128,6 +129,7 @@ export function sort_groups(stream_ids: number[], search_term: string): StreamLi
const pinned_section: StreamListSection = { const pinned_section: StreamListSection = {
id: "pinned-streams", id: "pinned-streams",
folder_id: null,
section_title: $t({defaultMessage: "PINNED CHANNELS"}), section_title: $t({defaultMessage: "PINNED CHANNELS"}),
streams: [], streams: [],
muted_streams: [], muted_streams: [],
@@ -135,6 +137,7 @@ export function sort_groups(stream_ids: number[], search_term: string): StreamLi
}; };
const normal_section: StreamListSection = { const normal_section: StreamListSection = {
id: "normal-streams", id: "normal-streams",
folder_id: null,
section_title: $t({defaultMessage: "CHANNELS"}), section_title: $t({defaultMessage: "CHANNELS"}),
streams: [], streams: [],
muted_streams: [], muted_streams: [],
@@ -161,6 +164,7 @@ export function sort_groups(stream_ids: number[], search_term: string): StreamLi
if (!section) { if (!section) {
section = { section = {
id: sub.folder_id.toString(), id: sub.folder_id.toString(),
folder_id: sub.folder_id,
section_title: folder.name.toUpperCase(), section_title: folder.name.toUpperCase(),
streams: [], streams: [],
muted_streams: [], muted_streams: [],

View File

@@ -103,6 +103,7 @@ test("no_subscribed_streams", () => {
sections: [ sections: [
{ {
id: "pinned-streams", id: "pinned-streams",
folder_id: null,
inactive_streams: [], inactive_streams: [],
muted_streams: [], muted_streams: [],
section_title: "translated: PINNED CHANNELS", section_title: "translated: PINNED CHANNELS",
@@ -110,6 +111,7 @@ test("no_subscribed_streams", () => {
}, },
{ {
id: "normal-streams", id: "normal-streams",
folder_id: null,
inactive_streams: [], inactive_streams: [],
muted_streams: [], muted_streams: [],
section_title: "translated: CHANNELS", section_title: "translated: CHANNELS",