From 9ac4b7f04710079a1621f998b8db59eff70623b5 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Tue, 19 Mar 2024 20:15:15 +0200 Subject: [PATCH] =?UTF-8?q?RED-7980=20-=20Don=E2=80=99t=20allow=20any=20us?= =?UTF-8?q?er=20actions=20at=20the=20original=20annotation=20while=20there?= =?UTF-8?q?=20is=20a=20related=20pending=20annotation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/app/models/file/annotation.wrapper.ts | 7 ++----- .../file-preview/services/file-data.service.ts | 14 ++++++++++++++ .../pdf-viewer/services/annotation-draw.service.ts | 6 ++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/apps/red-ui/src/app/models/file/annotation.wrapper.ts b/apps/red-ui/src/app/models/file/annotation.wrapper.ts index c2bb7923d..c44691702 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -66,6 +66,7 @@ export class AnnotationWrapper implements IListable { isRemovedLocally = false; hiddenInWorkload = false; lastManualChange: ManualRedactionType; + entry: IEntityLogEntry; get isRuleBased() { return this.engines.includes(LogEntryEngines.RULE); @@ -275,10 +276,6 @@ export class AnnotationWrapper implements IListable { const lastRelevantManualChange = logEntry.manualChanges?.at(-1); annotationWrapper.lastManualChange = lastRelevantManualChange?.manualRedactionType; - if (annotationWrapper.pending) { - const removedEntry = allLogEntries.find((e: IEntityLogEntry) => e.id === annotationWrapper.id); - logEntry.oldState = removedEntry?.state; - } annotationWrapper.superType = SuperTypeMapper[logEntry.entryType][logEntry.state](logEntry); annotationWrapper.superTypeLabel = annotationTypesTranslations[annotationWrapper.superType]; @@ -295,7 +292,7 @@ export class AnnotationWrapper implements IListable { annotationWrapper.color = dictionary ? (dictionary[colorKey] as string) : (defaultColors[defaultColor] as string); } - annotationWrapper['entry'] = logEntry; + annotationWrapper.entry = logEntry; return annotationWrapper; } diff --git a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts index 6f4db12a1..177099cd6 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts @@ -228,6 +228,12 @@ export class FileDataService extends EntitiesService= 0; i--) { + if (annotations[i].id === pendingEntry.id) { + return annotations[i]; + } + } + } } diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts index e167d6a94..b888686b6 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts @@ -132,7 +132,7 @@ export class AnnotationDrawService { return; } - if (annotationWrapper.pending) { + if (annotationWrapper.pending && annotationWrapper.id.includes('pending')) { const polylineAnnot = this._pdf.polyline(); polylineAnnot.ReadOnly = true; polylineAnnot.StrokeColor = this.convertColor(annotationWrapper.color); @@ -140,8 +140,6 @@ export class AnnotationDrawService { polylineAnnot.Id = annotationWrapper.id; polylineAnnot.PageNumber = pageNumber; polylineAnnot.Opacity = polylineAnnot.Id.endsWith('pending') ? 0 : 0.5; - console.log(polylineAnnot.Id); - console.log(polylineAnnot.Id.split('-')); const points = this.#computePolylinePoints(annotationWrapper.positions, annotationWrapper.pageNumber); for (let i = 0; i < points.length; i++) { @@ -190,7 +188,7 @@ export class AnnotationDrawService { annotation.setCustomData('skipped', String(annotationWrapper.isSkipped)); annotation.setCustomData('changeLog', String(annotationWrapper.isChangeLogEntry)); annotation.setCustomData('changeLogRemoved', String(annotationWrapper.isRemoved)); - annotation.setCustomData('opacity', String(!annotationWrapper.pending ? annotation.Opacity : annotation.Opacity / 2)); + annotation.setCustomData('opacity', String(annotation.Opacity)); const redactionColor = this._defaultColorsService.getColor(dossierTemplateId, 'previewColor'); annotation.setCustomData('redactionColor', String(redactionColor));