Merge branch 'release/v1.2' of github.com:ONLYOFFICE/AppServer into release/v1.2

This commit is contained in:
Ilya Oleshko 2022-05-20 16:29:22 +03:00
commit 66b7e8eb61

View File

@ -179,9 +179,13 @@ class UploadDataStore {
cancelCurrentUpload = (id) => {
const newFiles = this.files.filter((el) => el.uniqueId !== id);
const uploadedFilesHistory = this.uploadedFilesHistory.filter(
(el) => el.uniqueId !== id
);
const newUploadData = {
files: newFiles,
uploadedFilesHistory,
filesSize: this.filesSize,
uploadedFiles: this.uploadedFiles,
percent: this.percent,
@ -239,9 +243,11 @@ class UploadDataStore {
if (!this.filesToConversion.length) {
this.filesToConversion.push(file);
this.uploadedFilesHistory.push(file);
this.startConversion(t);
} else {
this.filesToConversion.push(file);
this.uploadedFilesHistory.push(file);
}
}
};
@ -323,6 +329,11 @@ class UploadDataStore {
const file = this.files.find((f) => f.fileId === fileId);
if (file) runInAction(() => (file.inConversion = true));
const historyFile = this.uploadedFilesHistory.find(
(f) => f.fileId === fileId
);
if (historyFile) runInAction(() => (historyFile.inConversion = true));
const data = await convertFile(fileId, itemPassword);
if (data && data[0]) {
@ -338,6 +349,11 @@ class UploadDataStore {
runInAction(() => {
const file = this.files.find((file) => file.fileId === fileId);
if (file) file.convertProgress = progress;
const historyFile = this.uploadedFilesHistory.find(
(file) => file.fileId === fileId
);
if (historyFile) historyFile.convertProgress = progress;
});
error = res && res[0] && res[0].error;
@ -352,6 +368,16 @@ class UploadDataStore {
file.inConversion = false;
if (fileInfo === "password") file.needPassword = true;
}
const historyFile = this.uploadedFilesHistory.find(
(file) => file.fileId === fileId
);
if (historyFile) {
historyFile.error = error;
historyFile.inConversion = false;
if (fileInfo === "password") historyFile.needPassword = true;
}
});
//this.refreshFiles(toFolderId, false);
@ -371,12 +397,23 @@ class UploadDataStore {
file.inConversion = false;
file.action = "converted";
}
const historyFile = this.uploadedFilesHistory.find(
(file) => file.fileId === fileId
);
if (historyFile) {
historyFile.convertProgress = progress;
historyFile.inConversion = false;
historyFile.action = "converted";
}
});
storeOriginalFiles && this.refreshFiles(file);
if (fileInfo && fileInfo !== "password") {
file.fileInfo = fileInfo;
historyFile.fileInfo = fileInfo;
needToRefreshFilesList && this.refreshFiles(file);
}