Merge branch 'RED-7550-2' into 'master'
RED-7550: updated canEdit conditions. See merge request redactmanager/red-ui!176
This commit is contained in:
commit
25446702df
@ -39,3 +39,9 @@ export const canResizeAnnotation = (annotation: AnnotationWrapper, canAddRedacti
|
||||
!annotation.isSkipped &&
|
||||
!annotation.pending &&
|
||||
(annotation.isRedacted || annotation.isImage || annotation.isDictBasedHint || annotation.isRecommendation);
|
||||
|
||||
export const canEditAnnotation = (annotation: AnnotationWrapper) => (annotation.isRedacted || annotation.isSkipped) && !annotation.isImage;
|
||||
|
||||
export const canEditHint = (annotation: AnnotationWrapper) => annotation.HINT || annotation.isIgnoredHint;
|
||||
|
||||
export const canEditImage = (annotation: AnnotationWrapper) => annotation.isImage;
|
||||
|
||||
@ -2,10 +2,12 @@ import { IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { Dictionary } from '@red/domain';
|
||||
import { Roles } from '@users/roles';
|
||||
import { isArray } from 'lodash-es';
|
||||
import { IMAGE_CATEGORIES } from '../../modules/file-preview/utils/constants';
|
||||
import {
|
||||
canAcceptRecommendation,
|
||||
canChangeLegalBasis,
|
||||
canEditAnnotation,
|
||||
canEditHint,
|
||||
canEditImage,
|
||||
canForceHint,
|
||||
canForceRedaction,
|
||||
canMarkAsFalsePositive,
|
||||
@ -61,11 +63,9 @@ export class AnnotationPermissions {
|
||||
permissions.canChangeLegalBasis = canChangeLegalBasis(annotation, canAddRedaction);
|
||||
permissions.canRecategorizeAnnotation = canRecategorizeAnnotation(annotation, canAddRedaction);
|
||||
permissions.canResizeAnnotation = canResizeAnnotation(annotation, canAddRedaction);
|
||||
|
||||
permissions.canEditAnnotations = (annotation.isSkipped || annotation.isRedacted) && !annotation.isImage;
|
||||
permissions.canEditHints = annotation.isIgnoredHint || annotation.isDictBasedHint || annotation.isHint;
|
||||
permissions.canEditImages = [...IMAGE_CATEGORIES, 'ocr'].includes(annotation.type);
|
||||
|
||||
permissions.canEditAnnotations = canEditAnnotation(annotation);
|
||||
permissions.canEditHints = canEditHint(annotation);
|
||||
permissions.canEditImages = canEditImage(annotation);
|
||||
summedPermissions._merge(permissions);
|
||||
}
|
||||
return summedPermissions;
|
||||
|
||||
@ -43,6 +43,7 @@ export class AnnotationWrapper implements IListable {
|
||||
AREA = false;
|
||||
HINT = false;
|
||||
IMAGE = false;
|
||||
IMAGE_HINT = false;
|
||||
section?: string;
|
||||
reference: string[] = [];
|
||||
imported = false;
|
||||
@ -91,7 +92,7 @@ export class AnnotationWrapper implements IListable {
|
||||
}
|
||||
|
||||
get isImage() {
|
||||
return this.type?.toLowerCase() === 'image' || this.IMAGE;
|
||||
return this.type?.toLowerCase() === 'image' || this.IMAGE || this.IMAGE_HINT;
|
||||
}
|
||||
|
||||
get isOCR() {
|
||||
@ -229,6 +230,7 @@ export class AnnotationWrapper implements IListable {
|
||||
annotationWrapper.HINT = logEntry.entryType === EntityTypes.HINT;
|
||||
annotationWrapper.IMAGE = logEntry.entryType === EntityTypes.IMAGE;
|
||||
annotationWrapper.AREA = logEntry.entryType === EntityTypes.AREA;
|
||||
annotationWrapper.IMAGE_HINT = logEntry.entryType === EntityTypes.IMAGE_HINT;
|
||||
|
||||
annotationWrapper.isIgnored = logEntry.state === EntryStates.IGNORED;
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ import { ActiveDossiersService } from '@services/dossiers/active-dossiers.servic
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
import { IMAGE_CATEGORIES } from '../../utils/constants';
|
||||
import { getEditRedactionOptions, RedactOrHintOption } from '../../utils/dialog-options';
|
||||
import { EditRedactionData, EditRedactResult } from '../../utils/dialog-types';
|
||||
import { LegalBasisOption } from '../manual-redaction-dialog/manual-annotation-dialog.component';
|
||||
@ -41,11 +40,11 @@ export class EditRedactionDialogComponent
|
||||
) {
|
||||
super();
|
||||
const annotations = this.data.annotations;
|
||||
this.isImage = annotations.reduce((acc, next) => acc && [...IMAGE_CATEGORIES, 'ocr'].includes(next.type), true);
|
||||
this.isImage = annotations.reduce((acc, next) => acc && next.isImage, true);
|
||||
this.redactedTexts = !this.isImage ? annotations.map(annotation => annotation.value) : null;
|
||||
this.isModifyDictionary = annotations.every(annotation => annotation.isModifyDictionary);
|
||||
this.isManualRedaction = annotations.every(annotation => annotation.type === SuperTypes.ManualRedaction);
|
||||
this.isHint = annotations.every(annotation => annotation.isHint);
|
||||
this.isHint = annotations.every(annotation => annotation.HINT);
|
||||
this.showExtras = !(this.isImage || this.isHint);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user