From 34ff3e38f11ca077c5b0772af9981f71e8ec8ee9 Mon Sep 17 00:00:00 2001 From: Montassar Ghanmy Date: Fri, 14 Mar 2025 09:22:07 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20pause/resume=20for=20uploa?= =?UTF-8?q?d=20modal=20(#856)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../files/services/file-upload-service.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tdrive/frontend/src/app/features/files/services/file-upload-service.ts b/tdrive/frontend/src/app/features/files/services/file-upload-service.ts index 672fd86e..2d479da4 100644 --- a/tdrive/frontend/src/app/features/files/services/file-upload-service.ts +++ b/tdrive/frontend/src/app/features/files/services/file-upload-service.ts @@ -123,6 +123,16 @@ class FileUploadService { if (status === 'completed') { this.rootStates.completed[key] = true; + // remaining roots + const roots = Object.keys(this.groupedPendingFiles); + const isAllPaused = roots.every( + root => this.rootStates.paused[root] || this.rootStates.completed[root], + ); + if (isAllPaused) { + this.uploadStatus = UploadStateEnum.Paused; + } else { + this.uploadStatus = UploadStateEnum.Progress; + } } // Add to the accumulator object @@ -513,7 +523,10 @@ class FileUploadService { for (const rootItem of Object.keys(rootItemIds)) { const rootItemId = rootItemIds[rootItem]; // check if the root completed skip it - if (this.rootStates.completed[rootItem]) continue; + if (this.rootStates.completed[rootItem]) { + delete this.rootStates.completed[rootItem]; + continue; + } this.deleteOneDriveItem({ companyId: this.companyId, id: rootItemId, @@ -527,10 +540,6 @@ class FileUploadService { this.groupIds = {}; this.notify(); - - // reset the states for next upload - this.resetStates(Object.keys(this.rootStates.completed)); - this.notify(); } public cancelRootUpload(id: string) {