Web: Removed useless api @trash call on first load
This commit is contained in:
parent
7ac3538c44
commit
014262ac75
@ -485,7 +485,19 @@ class FilesStore {
|
|||||||
if (!this.isEditor) {
|
if (!this.isEditor) {
|
||||||
requests.push(
|
requests.push(
|
||||||
getPortalCultures(),
|
getPortalCultures(),
|
||||||
this.treeFoldersStore.fetchTreeFolders()
|
this.treeFoldersStore.fetchTreeFolders().then((treeFolders) => {
|
||||||
|
if (!treeFolders || !treeFolders.length) return;
|
||||||
|
|
||||||
|
const trashFolder = treeFolders.find(
|
||||||
|
(f) => f.rootFolderType == FolderType.TRASH
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!trashFolder) return;
|
||||||
|
|
||||||
|
const isEmpty = !trashFolder.foldersCount && !trashFolder.filesCount;
|
||||||
|
|
||||||
|
this.setTrashIsEmpty(isEmpty);
|
||||||
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isDesktopClient) {
|
if (isDesktopClient) {
|
||||||
@ -493,7 +505,6 @@ class FilesStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
requests.push(getFilesSettings());
|
requests.push(getFilesSettings());
|
||||||
requests.push(this.getIsEmptyTrash());
|
|
||||||
|
|
||||||
return Promise.all(requests).then(() => this.setIsInit(true));
|
return Promise.all(requests).then(() => this.setIsInit(true));
|
||||||
};
|
};
|
||||||
|
@ -175,36 +175,27 @@ export function getFoldersTree() {
|
|||||||
const folders = sortInDisplayOrder(response);
|
const folders = sortInDisplayOrder(response);
|
||||||
|
|
||||||
return folders.map((data, index) => {
|
return folders.map((data, index) => {
|
||||||
const type = +data.current.rootFolderType;
|
const { new: newItems, pathParts, current, folders, files } = data;
|
||||||
|
const { foldersCount, filesCount } = current;
|
||||||
|
const { parentId, title, id, rootFolderType, security } = current;
|
||||||
|
|
||||||
|
const type = +rootFolderType;
|
||||||
|
|
||||||
const name = getFolderClassNameByType(type);
|
const name = getFolderClassNameByType(type);
|
||||||
const isRecycleBinFolder = type === FolderType.TRASH;
|
|
||||||
return {
|
return {
|
||||||
id: data.current.id,
|
id,
|
||||||
key: `0-${index}`,
|
key: `0-${index}`,
|
||||||
parentId: data.current.parentId,
|
parentId,
|
||||||
title: data.current.title,
|
title,
|
||||||
rootFolderType: type,
|
rootFolderType: type,
|
||||||
folderClassName: name,
|
folderClassName: name,
|
||||||
// folders: !isRecycleBinFolder
|
|
||||||
// ? data.folders.map((folder) => {
|
|
||||||
// return {
|
|
||||||
// id: folder.id,
|
|
||||||
// title: folder.title,
|
|
||||||
// access: folder.access,
|
|
||||||
// foldersCount: folder.foldersCount,
|
|
||||||
// rootFolderType: folder.rootFolderType,
|
|
||||||
// providerKey: folder.providerKey,
|
|
||||||
// newItems: folder.new,
|
|
||||||
// };
|
|
||||||
// })
|
|
||||||
// : null,
|
|
||||||
folders: null,
|
folders: null,
|
||||||
pathParts: data.pathParts,
|
pathParts,
|
||||||
foldersCount: !isRecycleBinFolder
|
foldersCount,
|
||||||
? data.current.foldersCount || data.folders.length
|
filesCount,
|
||||||
: null,
|
newItems,
|
||||||
newItems: data.new,
|
security,
|
||||||
security: data.current.security,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user