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

This commit updates webapp code to include archived folder IDs as
well in the "order" list passed when re-ordering folders.

Also, updated API documentation to mention that archived folder IDs
should also be included.
This commit is contained in:
Sahil Batra
2025-08-08 13:15:45 +05:30
committed by Tim Abbott
parent b746bb5fc1
commit f7e9f37edc
2 changed files with 11 additions and 0 deletions

View File

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

View File

@@ -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: