From 9e0ec97845a80b86c45f38686d0737695c45bbd9 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Mon, 28 Oct 2024 17:22:54 +0200 Subject: [PATCH] RED-10256 - Bulk-local: Changes should not be filtered + Remove for image-based redactions --- .../remove-annotation-dialog.component.ts | 3 +-- .../remove-redaction-dialog.component.ts | 2 -- .../file-preview/utils/dialog-options.ts | 17 ++++++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.ts index 11c80ccc4..6571d4ecc 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.ts @@ -46,13 +46,12 @@ export class RemoveAnnotationDialogComponent extends IqserDialogComponent< readonly iconButtonTypes = IconButtonTypes; readonly options: DetailsRadioOption[]; readonly redactedTexts: string[]; - readonly isImage = this.data.redactions.reduce((acc, next) => acc && next.isImage, true); form!: UntypedFormGroup; constructor(private readonly _formBuilder: FormBuilder) { super(); - this.options = getRemoveRedactionOptions(this.data, this.data.applyToAllDossiers, this.isImage, true); + this.options = getRemoveRedactionOptions(this.data, this.data.applyToAllDossiers, true); this.redactedTexts = this.data.redactions.map(annotation => annotation.value); this.form = this.#getForm(); } diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts index 5ec97ffbf..0ffa843bb 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts @@ -66,7 +66,6 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< readonly recommendation = this.data.redactions.every(redaction => redaction.isRecommendation); readonly hint = this.data.redactions.every(redaction => redaction.isHint); readonly annotationsType = this.hint ? 'hint' : this.recommendation ? 'recommendation' : 'redaction'; - readonly isImage = this.data.redactions.reduce((acc, next) => acc && next.isImage, true); readonly optionByType = { recommendation: { main: this._userPreferences.getRemoveRecommendationDefaultOption(), @@ -108,7 +107,6 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< : getRemoveRedactionOptions( this.data, this.isSystemDefault || this.isExtraOptionSystemDefault ? this.#applyToAllDossiers : this.extraOptionPreference, - this.isImage, ); readonly skipped = this.data.redactions.some(annotation => annotation.isSkipped); readonly redactedTexts = this.data.redactions.map(annotation => annotation.value); diff --git a/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts b/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts index 9016bce7f..f4390648c 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts @@ -166,12 +166,12 @@ export const getResizeRedactionOptions = ( export const getRemoveRedactionOptions = ( data: RemoveRedactionData, applyToAllDossiers: boolean, - isImage: boolean, isDocumine: boolean = false, ): DetailsRadioOption[] => { const translations = isDocumine ? removeAnnotationTranslations : removeRedactionTranslations; const { permissions, redactions, isApprover, falsePositiveContext } = data; const isBulk = redactions.length > 1; + const isImage = redactions.reduce((acc, next) => acc && next.isImage, true); const options: DetailsRadioOption[] = []; if (permissions.canRemoveOnlyHere && !isImage) { @@ -187,12 +187,15 @@ export const getRemoveRedactionOptions = ( value: RemoveRedactionOptions.ONLY_HERE, }); - options.push({ - label: removeRedactionTranslations.IN_DOCUMENT.label, - description: removeRedactionTranslations.IN_DOCUMENT.description, - icon: DOCUMENT_ICON, - value: RemoveRedactionOptions.IN_DOCUMENT, - }); + const isHint = redactions.reduce((acc, next) => acc && next.isHint, true); + if (!isHint) { + options.push({ + label: removeRedactionTranslations.IN_DOCUMENT.label, + description: removeRedactionTranslations.IN_DOCUMENT.description, + icon: DOCUMENT_ICON, + value: RemoveRedactionOptions.IN_DOCUMENT, + }); + } } if (permissions.canRemoveFromDictionary) { options.push({