From 1c70610a06b88f532c8344bc0066bb3576157760 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Thu, 18 Jan 2024 09:00:18 +0200 Subject: [PATCH] RED-7980 - Not all unprocessed annotations are displayed correctly --- apps/red-ui/src/app/models/file/annotation.wrapper.ts | 4 ++++ .../annotation-card/annotation-card.component.ts | 11 ++++++++++- .../src/app/modules/file-preview/utils/constants.ts | 7 +++++++ 3 files changed, 21 insertions(+), 1 deletion(-) 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 441b0ae03..67eec1e76 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -18,12 +18,14 @@ import { LogEntryEngine, LogEntryEngines, LowLevelFilterTypes, + ManualRedactionType, ManualRedactionTypes, SuperType, SuperTypeMapper, SuperTypes, } from '@red/domain'; import { annotationTypesTranslations } from '@translations/annotation-types-translations'; +import { log } from '@common-ui/utils'; export class AnnotationWrapper implements IListable { id: string; @@ -63,6 +65,7 @@ export class AnnotationWrapper implements IListable { hasBeenRemovedByManualOverride: boolean; isRemoved = false; isRemovedLocally = false; + lastManualChange: ManualRedactionType; get isRuleBased() { return this.engines.includes(LogEntryEngines.RULE); @@ -269,6 +272,7 @@ export class AnnotationWrapper implements IListable { annotationWrapper.content = content; const lastRelevantManualChange = logEntry.manualChanges?.at(-1); + annotationWrapper.lastManualChange = lastRelevantManualChange?.manualRedactionType; annotationWrapper.pending = lastRelevantManualChange && !lastRelevantManualChange.processed; annotationWrapper.superType = SuperTypeMapper[logEntry.entryType][logEntry.state](logEntry); annotationWrapper.superTypeLabel = annotationTypesTranslations[annotationWrapper.superType]; diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.ts index 10cba30f6..f338a3cda 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.ts @@ -3,6 +3,8 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { MultiSelectService } from '../../services/multi-select.service'; import { annotationTypesTranslations } from '@translations/annotation-types-translations'; import { Roles } from '@users/roles'; +import { ImageCategory } from '../../utils/constants'; +import { ManualRedactionTypes } from '@red/domain'; @Component({ selector: 'redaction-annotation-card', @@ -18,6 +20,13 @@ export class AnnotationCardComponent { constructor(readonly multiSelectService: MultiSelectService) {} get pending() { - return this.annotation.pending && this.annotation.isModifyDictionary && !this.annotation.isRemovedLocally; + return ( + this.annotation.pending && + ((this.annotation.isModifyDictionary && + !this.annotation.isRemovedLocally && + !this.annotation.hasBeenForcedHint && + this.annotation.lastManualChange !== ManualRedactionTypes.LEGAL_BASIS_CHANGE) || + this.annotation.type === ImageCategory.SIGNATURE) + ); } } diff --git a/apps/red-ui/src/app/modules/file-preview/utils/constants.ts b/apps/red-ui/src/app/modules/file-preview/utils/constants.ts index 093e039e2..3abcf54fc 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/constants.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/constants.ts @@ -1,6 +1,13 @@ import { List, ValuesOf } from '@iqser/common-ui/lib/utils'; export const IMAGE_CATEGORIES: readonly string[] = ['signature', 'logo', 'formula', 'image']; +export const ImageCategory = { + SIGNATURE: 'signature', + LOGO: 'logo', + FORMULA: 'formula', + IMAGE: 'image', +} as const; + export const ActionsHelpModeKeys = { redaction: 'redaction', 'manual-redaction': 'redaction',