RED-10256 - Bulk-local: Changes should not be filtered + Remove for image-based redactions

This commit is contained in:
Valentin Mihai 2024-10-28 17:22:54 +02:00
parent 0259bcee06
commit 9e0ec97845
3 changed files with 11 additions and 11 deletions

View File

@ -46,13 +46,12 @@ export class RemoveAnnotationDialogComponent extends IqserDialogComponent<
readonly iconButtonTypes = IconButtonTypes; readonly iconButtonTypes = IconButtonTypes;
readonly options: DetailsRadioOption<RemoveAnnotationOption>[]; readonly options: DetailsRadioOption<RemoveAnnotationOption>[];
readonly redactedTexts: string[]; readonly redactedTexts: string[];
readonly isImage = this.data.redactions.reduce((acc, next) => acc && next.isImage, true);
form!: UntypedFormGroup; form!: UntypedFormGroup;
constructor(private readonly _formBuilder: FormBuilder) { constructor(private readonly _formBuilder: FormBuilder) {
super(); 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.redactedTexts = this.data.redactions.map(annotation => annotation.value);
this.form = this.#getForm(); this.form = this.#getForm();
} }

View File

@ -66,7 +66,6 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
readonly recommendation = this.data.redactions.every(redaction => redaction.isRecommendation); readonly recommendation = this.data.redactions.every(redaction => redaction.isRecommendation);
readonly hint = this.data.redactions.every(redaction => redaction.isHint); readonly hint = this.data.redactions.every(redaction => redaction.isHint);
readonly annotationsType = this.hint ? 'hint' : this.recommendation ? 'recommendation' : 'redaction'; readonly annotationsType = this.hint ? 'hint' : this.recommendation ? 'recommendation' : 'redaction';
readonly isImage = this.data.redactions.reduce((acc, next) => acc && next.isImage, true);
readonly optionByType = { readonly optionByType = {
recommendation: { recommendation: {
main: this._userPreferences.getRemoveRecommendationDefaultOption(), main: this._userPreferences.getRemoveRecommendationDefaultOption(),
@ -108,7 +107,6 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
: getRemoveRedactionOptions( : getRemoveRedactionOptions(
this.data, this.data,
this.isSystemDefault || this.isExtraOptionSystemDefault ? this.#applyToAllDossiers : this.extraOptionPreference, this.isSystemDefault || this.isExtraOptionSystemDefault ? this.#applyToAllDossiers : this.extraOptionPreference,
this.isImage,
); );
readonly skipped = this.data.redactions.some(annotation => annotation.isSkipped); readonly skipped = this.data.redactions.some(annotation => annotation.isSkipped);
readonly redactedTexts = this.data.redactions.map(annotation => annotation.value); readonly redactedTexts = this.data.redactions.map(annotation => annotation.value);

View File

@ -166,12 +166,12 @@ export const getResizeRedactionOptions = (
export const getRemoveRedactionOptions = ( export const getRemoveRedactionOptions = (
data: RemoveRedactionData, data: RemoveRedactionData,
applyToAllDossiers: boolean, applyToAllDossiers: boolean,
isImage: boolean,
isDocumine: boolean = false, isDocumine: boolean = false,
): DetailsRadioOption<RemoveRedactionOption>[] => { ): DetailsRadioOption<RemoveRedactionOption>[] => {
const translations = isDocumine ? removeAnnotationTranslations : removeRedactionTranslations; const translations = isDocumine ? removeAnnotationTranslations : removeRedactionTranslations;
const { permissions, redactions, isApprover, falsePositiveContext } = data; const { permissions, redactions, isApprover, falsePositiveContext } = data;
const isBulk = redactions.length > 1; const isBulk = redactions.length > 1;
const isImage = redactions.reduce((acc, next) => acc && next.isImage, true);
const options: DetailsRadioOption<RemoveRedactionOption>[] = []; const options: DetailsRadioOption<RemoveRedactionOption>[] = [];
if (permissions.canRemoveOnlyHere && !isImage) { if (permissions.canRemoveOnlyHere && !isImage) {
@ -187,6 +187,8 @@ export const getRemoveRedactionOptions = (
value: RemoveRedactionOptions.ONLY_HERE, value: RemoveRedactionOptions.ONLY_HERE,
}); });
const isHint = redactions.reduce((acc, next) => acc && next.isHint, true);
if (!isHint) {
options.push({ options.push({
label: removeRedactionTranslations.IN_DOCUMENT.label, label: removeRedactionTranslations.IN_DOCUMENT.label,
description: removeRedactionTranslations.IN_DOCUMENT.description, description: removeRedactionTranslations.IN_DOCUMENT.description,
@ -194,6 +196,7 @@ export const getRemoveRedactionOptions = (
value: RemoveRedactionOptions.IN_DOCUMENT, value: RemoveRedactionOptions.IN_DOCUMENT,
}); });
} }
}
if (permissions.canRemoveFromDictionary) { if (permissions.canRemoveFromDictionary) {
options.push({ options.push({
label: isBulk ? translations.IN_DOSSIER.labelBulk : translations.IN_DOSSIER.label, label: isBulk ? translations.IN_DOSSIER.labelBulk : translations.IN_DOSSIER.label,