mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
stream_list: Add folder ids to StreamListSection object.
Followup to https://github.com/zulip/zulip/pull/35075#discussion_r2232041259
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user