Merge branch 'RED-8907' into 'master'
RED-8907: changed dialog options permissions based on local changes. See merge request redactmanager/red-ui!379
This commit is contained in:
commit
7167d36f7a
@ -13,7 +13,10 @@ export const canForceRedaction = (annotation: AnnotationWrapper, canAddRedaction
|
||||
export const canAcceptRecommendation = (annotation: AnnotationWrapper) => annotation.isRecommendation && !annotation.pending;
|
||||
|
||||
export const canMarkAsFalsePositive = (annotation: AnnotationWrapper, annotationEntity: Dictionary) =>
|
||||
annotation.canBeMarkedAsFalsePositive && !annotation.hasBeenForcedRedaction && annotationEntity?.hasDictionary;
|
||||
annotation.canBeMarkedAsFalsePositive &&
|
||||
!annotation.hasBeenForcedRedaction &&
|
||||
!annotation.hasBeenResizedLocally &&
|
||||
annotationEntity?.hasDictionary;
|
||||
|
||||
export const canRemoveOnlyHere = (annotation: AnnotationWrapper, canAddRedaction: boolean, autoAnalysisDisabled: boolean) =>
|
||||
canAddRedaction &&
|
||||
@ -24,7 +27,8 @@ export const canRemoveFromDictionary = (annotation: AnnotationWrapper, autoAnaly
|
||||
annotation.isModifyDictionary &&
|
||||
(annotation.isRedacted || annotation.isSkipped || annotation.isHint || (annotation.isIgnoredHint && !annotation.isRuleBased)) &&
|
||||
(autoAnalysisDisabled || !annotation.pending) &&
|
||||
!annotation.hasBeenResized;
|
||||
!annotation.hasBeenResizedLocally &&
|
||||
(!annotation.hasBeenForcedHint || !annotation.hasBeenForcedRedaction);
|
||||
|
||||
export const canRemoveRedaction = (annotation: AnnotationWrapper, permissions: AnnotationPermissions) =>
|
||||
(!annotation.isIgnoredHint || !annotation.isRuleBased) &&
|
||||
|
||||
@ -57,6 +57,7 @@ export class AnnotationWrapper implements IListable {
|
||||
isChangeLogEntry = false;
|
||||
engines: LogEntryEngine[] = [];
|
||||
hasBeenResized: boolean;
|
||||
hasBeenResizedLocally: boolean;
|
||||
hasBeenRecategorized: boolean;
|
||||
hasLegalBasisChanged: boolean;
|
||||
hasBeenForcedHint: boolean;
|
||||
@ -253,20 +254,20 @@ export class AnnotationWrapper implements IListable {
|
||||
annotationWrapper.section = logEntry.section;
|
||||
annotationWrapper.reference = logEntry.reference || [];
|
||||
annotationWrapper.hasBeenResized = !!logEntry.manualChanges?.find(c => c.manualRedactionType === ManualRedactionTypes.RESIZE);
|
||||
annotationWrapper.hasBeenResizedLocally =
|
||||
annotationWrapper.hasBeenResized && annotationWrapper.engines.includes(LogEntryEngines.MANUAL);
|
||||
annotationWrapper.hasBeenRecategorized = !!logEntry.manualChanges?.find(
|
||||
c => c.manualRedactionType === ManualRedactionTypes.RECATEGORIZE,
|
||||
);
|
||||
annotationWrapper.hasLegalBasisChanged = !!logEntry.manualChanges?.find(
|
||||
c => c.manualRedactionType === ManualRedactionTypes.LEGAL_BASIS_CHANGE,
|
||||
);
|
||||
annotationWrapper.hasBeenForcedHint = !!logEntry.manualChanges?.find(
|
||||
c => c.manualRedactionType === ManualRedactionTypes.FORCE_HINT,
|
||||
);
|
||||
annotationWrapper.hasBeenForcedHint = !!logEntry.manualChanges?.find(c => c.manualRedactionType === ManualRedactionTypes.FORCE);
|
||||
annotationWrapper.hasBeenForcedRedaction = !!logEntry.manualChanges?.find(
|
||||
c => c.manualRedactionType === ManualRedactionTypes.FORCE_REDACT,
|
||||
c => c.manualRedactionType === ManualRedactionTypes.FORCE,
|
||||
);
|
||||
annotationWrapper.hasBeenRemovedByManualOverride = !!logEntry.manualChanges?.find(
|
||||
c => c.manualRedactionType === ManualRedactionTypes.REMOVE_LOCALLY,
|
||||
c => c.manualRedactionType === ManualRedactionTypes.REMOVE,
|
||||
);
|
||||
|
||||
const content = this.#createContent(annotationWrapper, logEntry, isDocumine);
|
||||
@ -279,7 +280,9 @@ export class AnnotationWrapper implements IListable {
|
||||
annotationWrapper.superTypeLabel = annotationTypesTranslations[annotationWrapper.superType];
|
||||
|
||||
annotationWrapper.isRemoved = logEntry.state === EntryStates.REMOVED;
|
||||
annotationWrapper.isRemovedLocally = lastRelevantManualChange?.manualRedactionType === ManualRedactionTypes.REMOVE_LOCALLY;
|
||||
annotationWrapper.isRemovedLocally =
|
||||
lastRelevantManualChange?.manualRedactionType === ManualRedactionTypes.REMOVE &&
|
||||
logEntry.engines.includes(LogEntryEngines.MANUAL);
|
||||
|
||||
annotationWrapper.typeLabel = dictionary?.virtual ? undefined : dictionary?.label;
|
||||
|
||||
|
||||
@ -127,22 +127,23 @@ export const getResizeRedactionOptions = (
|
||||
if (isRss) {
|
||||
return options;
|
||||
}
|
||||
|
||||
const dictBasedType = redaction.isModifyDictionary;
|
||||
options.push({
|
||||
label: translations.inDossier.label,
|
||||
description: translations.inDossier.description,
|
||||
descriptionParams: { dossierName: dossier.dossierName },
|
||||
disabled: !dictBasedType || redaction.hasBeenRecategorized,
|
||||
tooltip: !dictBasedType ? translations.inDossier.tooltip : null,
|
||||
icon: FOLDER_ICON,
|
||||
value: RedactOrHintOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: translations.inDossier.extraOptionLabel,
|
||||
checked: applyToAllDossiers,
|
||||
hidden: !isApprover,
|
||||
},
|
||||
});
|
||||
if (!redaction.hasBeenResizedLocally) {
|
||||
const dictBasedType = redaction.isModifyDictionary;
|
||||
options.push({
|
||||
label: translations.inDossier.label,
|
||||
description: translations.inDossier.description,
|
||||
descriptionParams: { dossierName: dossier.dossierName },
|
||||
disabled: !dictBasedType || redaction.hasBeenRecategorized,
|
||||
tooltip: !dictBasedType ? translations.inDossier.tooltip : null,
|
||||
icon: FOLDER_ICON,
|
||||
value: RedactOrHintOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: translations.inDossier.extraOptionLabel,
|
||||
checked: applyToAllDossiers,
|
||||
hidden: !isApprover,
|
||||
},
|
||||
});
|
||||
}
|
||||
return options;
|
||||
};
|
||||
|
||||
|
||||
@ -13,14 +13,13 @@ export type LogEntryEngine = ValuesOf<typeof LogEntryEngines>;
|
||||
export const ManualRedactionTypes = {
|
||||
ADD_LOCALLY: 'ADD_LOCALLY',
|
||||
ADD_TO_DICTIONARY: 'ADD_TO_DICTIONARY',
|
||||
REMOVE_LOCALLY: 'REMOVE_LOCALLY',
|
||||
REMOVE: 'REMOVE',
|
||||
REMOVE_FROM_DICTIONARY: 'REMOVE_FROM_DICTIONARY',
|
||||
FORCE_REDACT: 'FORCE_REDACT',
|
||||
FORCE_HINT: 'FORCE_HINT',
|
||||
FORCE: 'FORCE',
|
||||
RECATEGORIZE: 'RECATEGORIZE',
|
||||
LEGAL_BASIS_CHANGE: 'LEGAL_BASIS_CHANGE',
|
||||
RESIZE: 'RESIZE',
|
||||
RESIZE_LOCALLY: 'RESIZE_LOCALLY',
|
||||
RESIZE_WITH_DICTIONARY: 'RESIZE_WITH_DICTIONARY',
|
||||
} as const;
|
||||
|
||||
export type ManualRedactionType = ValuesOf<typeof ManualRedactionTypes>;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user