Merge pull request #1243 from ONLYOFFICE/bugfix/fixed-files-conversion

Web: Files: fixed conversion
This commit is contained in:
Ilya Oleshko 2023-03-01 11:18:13 +03:00 committed by GitHub
commit f1e9c000fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 12 deletions

View File

@ -171,6 +171,7 @@ const Items = ({
onHide,
firstLoad,
deleteAction,
startDrag,
}) => {
useEffect(() => {
data.forEach((elem) => {
@ -265,7 +266,12 @@ const Items = ({
return false;
}
if (!draggableItems || draggableItems.find((x) => x.id === item.id))
if (
!draggableItems ||
draggableItems.find(
(x) => x.id === item.id && x.isFolder === item.isFolder
)
)
return false;
if (
@ -281,7 +287,7 @@ const Items = ({
(item.pathParts[0] === myId || item.pathParts[0] === commonId)) ||
item.rootFolderType === FolderType.USER ||
item.rootFolderType === FolderType.COMMON ||
item.rootFolderType === FolderType.TRASH
(item.rootFolderType === FolderType.TRASH && startDrag)
) {
return true;
}
@ -417,9 +423,9 @@ export default inject(
selection,
dragging,
setDragging,
setStartDrag,
trashIsEmpty,
firstLoad,
startDrag,
} = filesStore;
const { startUpload } = uploadDataStore;
@ -456,7 +462,6 @@ export default inject(
draggableItems: dragging ? selection : null,
dragging,
setDragging,
setStartDrag,
moveDragItems,
deleteAction,
startUpload,
@ -465,6 +470,7 @@ export default inject(
trashIsEmpty,
rootFolderType,
firstLoad,
startDrag,
};
}
)(withTranslation(["Files", "Common", "Translations"])(observer(Items)));

View File

@ -67,7 +67,9 @@ export default inject(({ uploadDataStore }, { item }) => {
const loadingFile = !file || !file.uniqueId ? null : file;
const currentFileUploadProgress =
file && loadingFile.uniqueId === item.uniqueId ? loadingFile.percent : null;
file && loadingFile?.uniqueId === item?.uniqueId
? loadingFile.percent
: null;
return {
percent: isParallel

View File

@ -367,6 +367,8 @@ class UploadDataStore {
isShareFolder,
} = this.treeFoldersStore;
if (!this.converted) return;
const { storeOriginalFiles } = this.settingsStore;
const isSortedFolder = isRecentFolder || isFavoritesFolder || isShareFolder;
@ -513,7 +515,7 @@ class UploadDataStore {
}
});
storeOriginalFiles && this.refreshFiles(file);
storeOriginalFiles && fileInfo && this.refreshFiles(file);
if (fileInfo && fileInfo !== "password") {
file.fileInfo = fileInfo;
@ -540,7 +542,7 @@ class UploadDataStore {
const percent = this.getConversationPercent(index + 1);
this.setConversionPercent(percent, !!error);
if (file.fileInfo.version > 2) {
if (!file.error && file.fileInfo.version > 2) {
this.filesStore.setUploadedFileIdWithVersion(file.fileInfo.id);
}
}
@ -623,8 +625,9 @@ class UploadDataStore {
}) > -1;
if (hasFolder) {
if (this.uploaded) this.isParallel = false;
else {
if (this.uploaded) {
this.isParallel = false;
} else if (this.isParallel) {
this.tempFiles.push({ uploadFiles, folderId, t });
return;
}
@ -850,7 +853,7 @@ class UploadDataStore {
newPercent = this.getFilesPercent(uploadedSize);
}
const percentCurrentFile = (index / length) * 100;
const percentCurrentFile = ((index + 1) / length) * 100;
const fileIndex = this.uploadedFilesHistory.findIndex(
(f) => f.uniqueId === this.files[indexOfFile].uniqueId
@ -1130,8 +1133,9 @@ class UploadDataStore {
if (!this.isParallel) return;
const allFilesIsUploaded =
this.files.findIndex((f) => f.action !== "uploaded" && !f.error) ===
-1;
this.files.findIndex(
(f) => f.action !== "uploaded" && f.action !== "convert" && !f.error
) === -1;
if (allFilesIsUploaded) {
if (!this.filesToConversion.length) {