diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html index 17e2a2fce..327f565c5 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html @@ -27,7 +27,7 @@ 1 - ? this.#isDocumine - ? this.annotationPermissions.canEditAnnotations - : this.annotationPermissions.canEditHints || - this.annotationPermissions.canEditImages || - this.annotationPermissions.canEditAnnotations - : canEditRedactions; + return ( + this.#annotationChangesAllowed && + (this.annotations.length > 1 + ? this.#isDocumine + ? this.annotationPermissions.canEditAnnotations + : this.annotationPermissions.canEditHints || + this.annotationPermissions.canEditImages || + this.annotationPermissions.canEditAnnotations + : canEditRedactions) + ); + } + + get canResize(): boolean { + return this.#annotationChangesAllowed && this.annotationPermissions.canResizeAnnotation && this.annotations.length === 1; } get canRemoveRedaction(): boolean { - return this.annotationPermissions.canRemoveRedaction && this.#sameType; + return this.#annotationChangesAllowed && this.annotationPermissions.canRemoveRedaction && this.#sameType; } get viewerAnnotations() { @@ -148,4 +155,8 @@ export class AnnotationActionsComponent implements OnChanges { this._iqserPermissionsService, ); } + + get #annotationChangesAllowed() { + return !this.#isDocumine || !this._state.file().excludedFromAutomaticAnalysis; + } } diff --git a/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts index dd33d80f7..d00289971 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts @@ -23,13 +23,13 @@ export class PdfAnnotationActionsService { readonly #annotationManager = inject(REDAnnotationManager); readonly #isDocumine = getConfig().IS_DOCUMINE; - get(annotations: AnnotationWrapper[]): IHeaderElement[] { + get(annotations: AnnotationWrapper[], annotationChangesAllowed: boolean): IHeaderElement[] { const availableActions: IHeaderElement[] = []; const permissions = this.#getAnnotationsPermissions(annotations); const sameType = annotations.every(a => a.type === annotations[0].type); // you can only resize one annotation at a time - if (permissions.canResizeAnnotation) { + if (permissions.canResizeAnnotation && annotationChangesAllowed) { const firstAnnotation = annotations[0]; // if we already entered resize-mode previously if (firstAnnotation.id === this.#annotationManager.resizingAnnotationId) { @@ -61,11 +61,11 @@ export class PdfAnnotationActionsService { permissions.canForceHint || permissions.canForceRedaction; const canEdit = - annotations.length > 1 + (annotations.length > 1 ? this.#isDocumine ? permissions.canEditAnnotations : permissions.canEditHints || permissions.canEditImages || permissions.canEditAnnotations - : canEditRedactions; + : canEditRedactions) && annotationChangesAllowed; if (canEdit) { const editButton = this.#getButton('edit', _('annotation-actions.edit-redaction.label'), () => this.#annotationActionsService.editRedaction(annotations), @@ -94,7 +94,7 @@ export class PdfAnnotationActionsService { availableActions.push(forceHintButton); } - if (permissions.canRemoveRedaction && sameType) { + if (permissions.canRemoveRedaction && sameType && annotationChangesAllowed) { const removeRedactionButton = this.#getButton('trash', _('annotation-actions.remove-annotation.remove-redaction'), () => this.#annotationActionsService.removeRedaction(annotations, permissions), ); diff --git a/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts b/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts index 772e1a670..c768d9d14 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts @@ -386,7 +386,10 @@ export class PdfProxyService { actions.push(visibilityButton); } - actions = this._multiSelectService.inactive() ? [...actions, ...this._pdfAnnotationActionsService.get(annotationWrappers)] : []; + const annotationChangesAllowed = !this.#isDocumine || !this._state.file().excludedFromAutomaticAnalysis; + actions = this._multiSelectService.inactive() + ? [...actions, ...this._pdfAnnotationActionsService.get(annotationWrappers, annotationChangesAllowed)] + : []; this._pdf.instance.UI.annotationPopup.update(actions); } diff --git a/libs/common-ui b/libs/common-ui index 87e1c8845..2bb459961 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 87e1c8845276faa17b2f5d29c9bf4b3601aae0c0 +Subproject commit 2bb459961af80944c5cd56bac8bff1fc786dbebc