fix(ui): show empty folders as move and download destinations (#999)

This commit is contained in:
Will Miao
2026-08-23 21:09:16 +08:00
parent 030a32f8fa
commit c2360a35ad
12 changed files with 630 additions and 19 deletions
+6 -2
View File
@@ -1206,9 +1206,13 @@ export class BaseModelApiClient {
}
}
async fetchUnifiedFolderTree() {
async fetchUnifiedFolderTree(options = {}) {
try {
const response = await fetch(this.apiConfig.endpoints.unifiedFolderTree);
const { includeEmpty = false } = options;
const url = includeEmpty
? `${this.apiConfig.endpoints.unifiedFolderTree}?include_empty=1`
: this.apiConfig.endpoints.unifiedFolderTree;
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Failed to fetch unified folder tree`);
}
+3 -2
View File
@@ -2134,8 +2134,9 @@ export class DownloadManager {
async initializeFolderTree() {
try {
// Fetch unified folder tree
const treeData = await this.apiClient.fetchUnifiedFolderTree();
// Fetch unified folder tree, including empty directories so they
// can be selected as download destinations
const treeData = await this.apiClient.fetchUnifiedFolderTree({ includeEmpty: true });
if (treeData.success) {
// Load tree data into folder tree manager
+3 -2
View File
@@ -200,8 +200,9 @@ class MoveManager {
async initializeFolderTree() {
try {
const apiClient = this._getApiClient();
// Fetch unified folder tree
const treeData = await apiClient.fetchUnifiedFolderTree();
// Fetch unified folder tree, including empty directories so they
// can be selected as move targets
const treeData = await apiClient.fetchUnifiedFolderTree({ includeEmpty: true });
if (treeData.success) {
// Load tree data into folder tree manager