RED-7990 fix rule based annotations cannot be resized

This commit is contained in:
Dan Percic 2023-11-30 15:52:13 +02:00
parent 0ad2966a5c
commit f1f3bffcf1
3 changed files with 9 additions and 4 deletions

View File

@ -37,11 +37,12 @@ export const canRecategorizeAnnotation = (annotation: AnnotationWrapper, canReca
((annotation.isImage && !annotation.isSuggestion) || annotation.isSuggestionRecategorizeImage || annotation.hintDictionary) &&
!annotation.pending;
export const canResizeAnnotation = (annotation: AnnotationWrapper, canAddRedaction: boolean) =>
export const canResizeAnnotation = (annotation: AnnotationWrapper, canAddRedaction: boolean, hasDictionary = false) =>
canAddRedaction &&
!annotation.isSkipped &&
!annotation.pending &&
(((annotation.isRedacted || annotation.isImage) && !annotation.isSuggestion) ||
annotation.isSuggestionResize ||
annotation.isDictBasedHint ||
annotation.isRecommendation);
annotation.isRecommendation ||
(hasDictionary && annotation.isRuleBased));

View File

@ -2,6 +2,7 @@ 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,
@ -16,7 +17,6 @@ import {
canUndo,
} from './annotation-permissions.utils';
import { AnnotationWrapper } from './annotation.wrapper';
import { IMAGE_CATEGORIES } from '../../modules/file-preview/utils/constants';
export class AnnotationPermissions {
canUndo = true;
@ -60,7 +60,7 @@ export class AnnotationPermissions {
permissions.canRemoveRedaction = canRemoveRedaction(annotation, permissions);
permissions.canChangeLegalBasis = canChangeLegalBasis(annotation, canAddRedaction);
permissions.canRecategorizeAnnotation = canRecategorizeAnnotation(annotation, canAddRedaction);
permissions.canResizeAnnotation = canResizeAnnotation(annotation, canAddRedaction);
permissions.canResizeAnnotation = canResizeAnnotation(annotation, canAddRedaction, annotationEntity.hasDictionary);
permissions.canEditAnnotations = (annotation.isSkipped || annotation.isRedacted) && !annotation.isImage;
permissions.canEditHints =

View File

@ -197,6 +197,10 @@ export class AnnotationWrapper implements IListable {
return !!SuggestionsSuperTypes[this.superType];
}
get isRuleBased() {
return this.engines.includes(LogEntryEngines.RULE);
}
get isSuggestionResize() {
return this.superType === SuperTypes.SuggestionResize;
}