From 70dcc385039eb183c586cfa9e4a710c82a71fe43 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Mon, 22 Jan 2024 15:42:32 +0200 Subject: [PATCH 1/3] RED-8270: fixed actions not available for manually added hints. --- .../app/models/file/annotation-permissions.utils.ts | 10 ++++------ .../annotation-card/annotation-card.component.html | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts b/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts index d19b067c3..500041df3 100644 --- a/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts +++ b/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts @@ -16,13 +16,11 @@ export const canMarkAsFalsePositive = (annotation: AnnotationWrapper, annotation annotation.canBeMarkedAsFalsePositive && annotationEntity?.hasDictionary; export const canRemoveOnlyHere = (annotation: AnnotationWrapper, canAddRedaction: boolean, autoAnalysisDisabled: boolean) => - canAddRedaction && - (autoAnalysisDisabled || !annotation.pending) && - (annotation.isRedacted || (annotation.isHint && !annotation.isImage)); + canAddRedaction && (autoAnalysisDisabled || !annotation.pending) && (annotation.isRedacted || (annotation.HINT && !annotation.isImage)); export const canRemoveFromDictionary = (annotation: AnnotationWrapper, autoAnalysisDisabled: boolean) => annotation.isModifyDictionary && - (annotation.isRedacted || annotation.isSkipped || annotation.isHint) && + (annotation.isRedacted || annotation.isSkipped || annotation.HINT) && (autoAnalysisDisabled || !annotation.pending) && !annotation.hasBeenResized; @@ -34,7 +32,7 @@ export const canChangeLegalBasis = (annotation: AnnotationWrapper, canAddRedacti canAddRedaction && annotation.isRedacted && (autoAnalysisDisabled || !annotation.pending); export const canRecategorizeAnnotation = (annotation: AnnotationWrapper, canRecategorize: boolean, autoAnalysisDisabled: boolean) => - canRecategorize && (annotation.isImage || annotation.isDictBasedHint) && (autoAnalysisDisabled || !annotation.pending); + canRecategorize && (annotation.isImage || annotation.HINT) && (autoAnalysisDisabled || !annotation.pending); export const canResizeAnnotation = ( annotation: AnnotationWrapper, @@ -47,7 +45,7 @@ export const canResizeAnnotation = ( (autoAnalysisDisabled || !annotation.pending) && (annotation.isRedacted || annotation.isImage || - annotation.isDictBasedHint || + annotation.HINT || annotation.isRecommendation || (hasDictionary && annotation.isRuleBased)); diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html index 99c2ed520..84d3dd438 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html @@ -24,7 +24,7 @@
: {{ annotation.shortContent }}
From a1f8451ee6bd5d3f33a0984629420d4d48949ddb Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Mon, 22 Jan 2024 16:31:07 +0200 Subject: [PATCH 2/3] RED-8270: prevent future bug. --- .../models/file/annotation-permissions.utils.ts | 10 ++++++---- .../src/app/models/file/annotation.wrapper.ts | 14 +++++--------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts b/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts index 500041df3..e1aab36d1 100644 --- a/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts +++ b/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts @@ -16,11 +16,13 @@ export const canMarkAsFalsePositive = (annotation: AnnotationWrapper, annotation annotation.canBeMarkedAsFalsePositive && annotationEntity?.hasDictionary; export const canRemoveOnlyHere = (annotation: AnnotationWrapper, canAddRedaction: boolean, autoAnalysisDisabled: boolean) => - canAddRedaction && (autoAnalysisDisabled || !annotation.pending) && (annotation.isRedacted || (annotation.HINT && !annotation.isImage)); + canAddRedaction && + (autoAnalysisDisabled || !annotation.pending) && + (annotation.isRedacted || (annotation.isHint && !annotation.isImage)); export const canRemoveFromDictionary = (annotation: AnnotationWrapper, autoAnalysisDisabled: boolean) => annotation.isModifyDictionary && - (annotation.isRedacted || annotation.isSkipped || annotation.HINT) && + (annotation.isRedacted || annotation.isSkipped || annotation.isHint) && (autoAnalysisDisabled || !annotation.pending) && !annotation.hasBeenResized; @@ -32,7 +34,7 @@ export const canChangeLegalBasis = (annotation: AnnotationWrapper, canAddRedacti canAddRedaction && annotation.isRedacted && (autoAnalysisDisabled || !annotation.pending); export const canRecategorizeAnnotation = (annotation: AnnotationWrapper, canRecategorize: boolean, autoAnalysisDisabled: boolean) => - canRecategorize && (annotation.isImage || annotation.HINT) && (autoAnalysisDisabled || !annotation.pending); + canRecategorize && (annotation.isImage || annotation.isHint) && (autoAnalysisDisabled || !annotation.pending); export const canResizeAnnotation = ( annotation: AnnotationWrapper, @@ -45,7 +47,7 @@ export const canResizeAnnotation = ( (autoAnalysisDisabled || !annotation.pending) && (annotation.isRedacted || annotation.isImage || - annotation.HINT || + annotation.isHint || annotation.isRecommendation || (hasDictionary && annotation.isRuleBased)); 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 67eec1e76..00eab80cd 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -126,7 +126,11 @@ export class AnnotationWrapper implements IListable { } get isHint() { - return this.superType === SuperTypes.Hint; + return this.superType === SuperTypes.Hint || this.superType === SuperTypes.ManualHint; + } + + get isIgnoredHint() { + return this.superType === SuperTypes.IgnoredHint; } get isEarmark() { @@ -145,14 +149,6 @@ export class AnnotationWrapper implements IListable { return 'square'; } - get isDictBasedHint() { - return this.isHint && this.engines.includes(LogEntryEngines.DICTIONARY); - } - - get isIgnoredHint() { - return this.superType === SuperTypes.IgnoredHint; - } - get isRedacted() { return this.superType === SuperTypes.Redaction || this.superType === SuperTypes.ManualRedaction; } From f51271521f729f7f00ee2f58d453188c9b87911e Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Tue, 23 Jan 2024 11:02:40 +0200 Subject: [PATCH 3/3] RED-8270 & RED-8272 & RED-8261. --- .../file/annotation-permissions.utils.ts | 23 +++++++++++-------- .../annotation-card.component.html | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts b/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts index e1aab36d1..4ea3ee437 100644 --- a/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts +++ b/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts @@ -34,7 +34,9 @@ export const canChangeLegalBasis = (annotation: AnnotationWrapper, canAddRedacti canAddRedaction && annotation.isRedacted && (autoAnalysisDisabled || !annotation.pending); export const canRecategorizeAnnotation = (annotation: AnnotationWrapper, canRecategorize: boolean, autoAnalysisDisabled: boolean) => - canRecategorize && (annotation.isImage || annotation.isHint) && (autoAnalysisDisabled || !annotation.pending); + canRecategorize && + (annotation.isImage || (annotation.isHint && !annotation.isRuleBased)) && + (autoAnalysisDisabled || !annotation.pending); export const canResizeAnnotation = ( annotation: AnnotationWrapper, @@ -42,17 +44,18 @@ export const canResizeAnnotation = ( autoAnalysisDisabled: boolean, hasDictionary = false, ) => - canAddRedaction && - !annotation.isSkipped && - (autoAnalysisDisabled || !annotation.pending) && - (annotation.isRedacted || - annotation.isImage || - annotation.isHint || - annotation.isRecommendation || - (hasDictionary && annotation.isRuleBased)); + (canAddRedaction && + !annotation.isSkipped && + !annotation.isIgnoredHint && + (autoAnalysisDisabled || !annotation.pending) && + (annotation.isRedacted || + annotation.isImage || + (annotation.isHint && !annotation.isRuleBased) || + (!annotation.isHint && hasDictionary && annotation.isRuleBased))) || + annotation.isRecommendation; export const canEditAnnotation = (annotation: AnnotationWrapper) => (annotation.isRedacted || annotation.isSkipped) && !annotation.isImage; -export const canEditHint = (annotation: AnnotationWrapper) => annotation.HINT || annotation.isIgnoredHint; +export const canEditHint = (annotation: AnnotationWrapper) => (annotation.isHint && !annotation.isRuleBased) || annotation.isIgnoredHint; export const canEditImage = (annotation: AnnotationWrapper) => annotation.isImage; diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html index 84d3dd438..99c2ed520 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html @@ -24,7 +24,7 @@
: {{ annotation.shortContent }}