This commit is contained in:
Manav Rathi 2024-04-26 08:41:13 +05:30
parent 16a07c79f4
commit 19fd1b5ce4
No known key found for this signature in database
3 changed files with 19 additions and 9 deletions

View file

@ -515,7 +515,7 @@ const ImageEditorOverlay = (props: IProps) => {
uploadManager.prepareForNewUpload();
uploadManager.showUploadProgressDialog();
uploadManager.queueFilesForUpload([file], [collection]);
uploadManager.uploadFiles([file], [collection]);
setFileURL(null);
props.onClose();
props.closePhotoViewer();

View file

@ -558,12 +558,11 @@ export default function Uploader(props: Props) {
),
);
}
const shouldCloseUploadProgress =
await uploadManager.queueFilesForUpload(
filesWithCollectionToUploadIn,
collections,
uploaderName,
);
const shouldCloseUploadProgress = await uploadManager.uploadFiles(
filesWithCollectionToUploadIn,
collections,
uploaderName,
);
if (shouldCloseUploadProgress) {
closeUploadProgress();
}
@ -595,7 +594,7 @@ export default function Uploader(props: Props) {
uploadManager.getFailedFilesWithCollections();
const uploaderName = uploadManager.getUploaderName();
await preUploadAction();
await uploadManager.queueFilesForUpload(
await uploadManager.uploadFiles(
/* TODO(MR): ElectronFile changes */
filesWithCollections.files as FileWithCollection[],
filesWithCollections.collections,

View file

@ -339,7 +339,18 @@ class UploadManager {
this.uiService.setUploadProgressView(true);
}
public async queueFilesForUpload(
/**
* Upload files
*
* This function waits for all the files to get uploaded (successfully or
* unsucessfully) before returning.
*
* @param filesWithCollectionToUploadIn The files to upload, each paired
* with the id of the collection that they should be uploaded into.
*
* @returns `true` if at least one file was processed
*/
public async uploadFiles(
filesWithCollectionToUploadIn: FileWithCollection[],
collections: Collection[],
uploaderName?: string,