From 916b9d6a89598147073f949d8cf3cd92e05d984d Mon Sep 17 00:00:00 2001 From: Timo Date: Tue, 5 Jan 2021 14:24:26 +0200 Subject: [PATCH] false positive direct action only in dev mode, hints can no longer be removed as annotations --- .../service/annotation-actions.service.ts | 5 +++- .../file/pdf-viewer/pdf-viewer.component.ts | 29 +++++++++++-------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/apps/red-ui/src/app/common/service/annotation-actions.service.ts b/apps/red-ui/src/app/common/service/annotation-actions.service.ts index 6832b96df..84a9068d2 100644 --- a/apps/red-ui/src/app/common/service/annotation-actions.service.ts +++ b/apps/red-ui/src/app/common/service/annotation-actions.service.ts @@ -34,7 +34,10 @@ export class AnnotationActionsService { public canDirectlySuggestToRemoveAnnotation(annotation: AnnotationWrapper): boolean { return ( - (annotation.isHint || (annotation.isManual && this._permissionsService.isManagerAndOwner() && !this.canUndoAnnotation(annotation))) && + // annotation.isHint || // HINTS CAN NO LONGER BE REMOVED DIRECTLY ONLY VIA DICTIONARY ACTION + annotation.isManual && + this._permissionsService.isManagerAndOwner() && + !this.canUndoAnnotation(annotation) && !annotation.isRecommendation ); } diff --git a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts index 62522c2e0..193771677 100644 --- a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts @@ -13,6 +13,7 @@ import { KeycloakService } from 'keycloak-angular'; import { environment } from '../../../../environments/environment'; import { AnnotationDrawService } from '../service/annotation-draw.service'; import { AnnotationActionsService } from '../../../common/service/annotation-actions.service'; +import { UserPreferenceService } from '../../../common/service/user-preference.service'; export interface ViewerState { displayMode?: any; @@ -60,6 +61,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { private readonly _appConfigService: AppConfigService, private readonly _manualAnnotationService: ManualAnnotationService, private readonly _ngZone: NgZone, + private readonly _userPreferenceService: UserPreferenceService, private readonly _annotationDrawService: AnnotationDrawService, private readonly _annotationActionsService: AnnotationActionsService ) {} @@ -261,18 +263,21 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { } }); - this.instance.textPopup.add({ - type: 'actionButton', - dataElement: 'add-false-positive', - img: '/assets/icons/general/pdftron-action-false-positive.svg', - title: this._translateService.instant(this._manualAnnotationService.getTitle('FALSE_POSITIVE')), - onClick: () => { - const selectedQuads = this.instance.docViewer.getSelectedTextQuads(); - const text = this.instance.docViewer.getSelectedText(); - const mre = this._getManualRedactionEntry(selectedQuads, text); - this.manualAnnotationRequested.emit(new ManualRedactionEntryWrapper(this.instance.docViewer.getSelectedTextQuads(), mre, 'FALSE_POSITIVE')); - } - }); + // Adding directly to the false-positive dict is only available in dev-mode + if (this._userPreferenceService.areDevFeaturesEnabled) { + this.instance.textPopup.add({ + type: 'actionButton', + dataElement: 'add-false-positive', + img: '/assets/icons/general/pdftron-action-false-positive.svg', + title: this._translateService.instant(this._manualAnnotationService.getTitle('FALSE_POSITIVE')), + onClick: () => { + const selectedQuads = this.instance.docViewer.getSelectedTextQuads(); + const text = this.instance.docViewer.getSelectedText(); + const mre = this._getManualRedactionEntry(selectedQuads, text); + this.manualAnnotationRequested.emit(new ManualRedactionEntryWrapper(this.instance.docViewer.getSelectedTextQuads(), mre, 'FALSE_POSITIVE')); + } + }); + } this.instance.textPopup.add({ type: 'actionButton',