mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +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 {
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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: [],
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user