Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

settings: Fix re-ordering folders when there is an archived folder.

Sahil Batraf7e9f37edce0
diff --git a/web/src/settings_folders.ts b/web/src/settings_folders.ts
index 581d13be595..e1dbb0a28a3 100644
--- a/web/src/settings_folders.ts
+++ b/web/src/settings_folders.ts
@@ -22,6 +22,13 @@ function update_folder_order(this: HTMLElement): void {
$(".channel-folder-row").each(function () {
order.push(Number.parseInt($(this).attr("data-channel-folder-id")!, 10));
});
+ const archived_folders = channel_folders
+ .get_channel_folders(true)
+ .filter((folder) => folder.is_archived)
+ .sort((a, b) => util.strcmp(a.name.toLowerCase(), b.name.toLowerCase()));
+ for (const folder of archived_folders) {
+ order.push(folder.id);
+ }
settings_ui.do_settings_change(
channel.patch,
"/json/channel_folders",
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index b4eda55f387..645eb1099d5 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -24554,6 +24554,10 @@ paths:
type: array
description: |
A list of channel folder IDs representing the new order.
+
+ This list must include the IDs of all the
+ organization's channel folders, including archived
+ folders.
items:
type: integer
encoding: