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.prepareForNewUpload();
uploadManager.showUploadProgressDialog(); uploadManager.showUploadProgressDialog();
uploadManager.queueFilesForUpload([file], [collection]); uploadManager.uploadFiles([file], [collection]);
setFileURL(null); setFileURL(null);
props.onClose(); props.onClose();
props.closePhotoViewer(); props.closePhotoViewer();

View file

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

View file

@ -339,7 +339,18 @@ class UploadManager {
this.uiService.setUploadProgressView(true); 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[], filesWithCollectionToUploadIn: FileWithCollection[],
collections: Collection[], collections: Collection[],
uploaderName?: string, uploaderName?: string,