This commit is contained in:
Manav Rathi 2024-04-24 12:35:27 +05:30
parent 239688b7d8
commit d96f710d6d
No known key found for this signature in database

View file

@ -41,10 +41,7 @@ import {
SegregatedFinishedUploads,
} from "types/upload/ui";
import { decryptFile, getUserOwnedFiles, sortFiles } from "utils/file";
import {
areFileWithCollectionsSame,
segregateMetadataAndMediaFiles,
} from "utils/upload";
import { segregateMetadataAndMediaFiles } from "utils/upload";
import { getLocalFiles } from "../fileService";
import {
getMetadataJSONMapKeyForJSON,
@ -552,7 +549,7 @@ class UploadManager {
log.info(
`post upload action -> fileUploadResult: ${fileUploadResult} uploadedFile present ${!!uploadedFile}`,
);
await this.updateElectronRemainingFiles(fileWithCollection);
await this.removeFromPendingUploads(fileWithCollection);
switch (fileUploadResult) {
case UPLOAD_RESULT.FAILED:
case UPLOAD_RESULT.BLOCKED:
@ -655,12 +652,10 @@ class UploadManager {
this.setFiles((files) => sortFiles([...files, decryptedFile]));
}
private async updateElectronRemainingFiles(
fileWithCollection: FileWithCollection2,
) {
private async removeFromPendingUploads(file: FileWithCollection2) {
if (isElectron()) {
this.remainingFiles = this.remainingFiles.filter(
(file) => !areFileWithCollectionsSame(file, fileWithCollection),
(f) => f.localID != file.localID,
);
await updatePendingUploads(this.remainingFiles);
}