From 35342707f0578f9c65bd9118c94b3fb47da06d12 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Thu, 1 Aug 2024 11:55:54 +0300 Subject: [PATCH] RED-9772: delete saved entity log on file overwrite. --- .../upload-download/services/file-upload.service.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/red-ui/src/app/modules/upload-download/services/file-upload.service.ts b/apps/red-ui/src/app/modules/upload-download/services/file-upload.service.ts index c4f82e77a..b1a747827 100644 --- a/apps/red-ui/src/app/modules/upload-download/services/file-upload.service.ts +++ b/apps/red-ui/src/app/modules/upload-download/services/file-upload.service.ts @@ -15,6 +15,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { HeadersConfiguration } from '@iqser/common-ui/lib/utils'; import { LicenseService } from '@services/license.service'; import { LicenseFeatures } from '../../admin/screens/license/utils/constants'; +import { TenantsService } from '@common-ui/tenants'; export interface ActiveUpload { subscription: Subscription; @@ -43,6 +44,7 @@ export class FileUploadService extends GenericService impleme private readonly _errorMessageService: ErrorMessageService, private readonly _licenseService: LicenseService, private readonly _toaster: Toaster, + private readonly _tenantsService: TenantsService, ) { super(); const fileFetch$ = this.#fetchFiles$.pipe( @@ -109,6 +111,11 @@ export class FileUploadService extends GenericService impleme option = res.applyToAllFiles ? currentOption : undefined; } + const existingFile = dossierFiles.find(pf => pf.filename === file.file.name); + if (OverwriteFileOptions.FULL_OVERWRITE === currentOption || OverwriteFileOptions.PARTIAL_OVERWRITE === currentOption) { + localStorage.removeItem(`${this._tenantsService.activeTenantId}-annotations-${existingFile.id}`); + } + if (currentOption === OverwriteFileOptions.PARTIAL_OVERWRITE) { file.keepManualRedactions = true; }