Merge branch 'master' into RED-7550

This commit is contained in:
Nicoleta Panaghiu 2023-09-15 13:24:28 +03:00
commit ca2084d9c3
5 changed files with 18 additions and 23 deletions

View File

@ -25,8 +25,9 @@ export const canRemoveFromDictionary = (annotation: AnnotationWrapper) =>
!annotation.pending && !annotation.pending &&
!annotation.hasBeenResized; !annotation.hasBeenResized;
export const canRemoveRedaction = (permissions: AnnotationPermissions) => export const canRemoveRedaction = (annotation: AnnotationWrapper, permissions: AnnotationPermissions) =>
permissions.canRemoveOnlyHere || permissions.canRemoveFromDictionary || permissions.canMarkAsFalsePositive; !annotation.isIgnoredHint &&
(permissions.canRemoveOnlyHere || permissions.canRemoveFromDictionary || permissions.canMarkAsFalsePositive);
export const canChangeLegalBasis = (annotation: AnnotationWrapper, canAddRedaction: boolean) => export const canChangeLegalBasis = (annotation: AnnotationWrapper, canAddRedaction: boolean) =>
canAddRedaction && annotation.isRedacted && !annotation.pending; canAddRedaction && annotation.isRedacted && !annotation.pending;

View File

@ -57,7 +57,7 @@ export class AnnotationPermissions {
permissions.canMarkAsFalsePositive = canMarkAsFalsePositive(annotation, annotationEntity); permissions.canMarkAsFalsePositive = canMarkAsFalsePositive(annotation, annotationEntity);
permissions.canRemoveOnlyHere = canRemoveOnlyHere(annotation, canAddRedaction); permissions.canRemoveOnlyHere = canRemoveOnlyHere(annotation, canAddRedaction);
permissions.canRemoveFromDictionary = canRemoveFromDictionary(annotation); permissions.canRemoveFromDictionary = canRemoveFromDictionary(annotation);
permissions.canRemoveRedaction = canRemoveRedaction(permissions); permissions.canRemoveRedaction = canRemoveRedaction(annotation, permissions);
permissions.canChangeLegalBasis = canChangeLegalBasis(annotation, canAddRedaction); permissions.canChangeLegalBasis = canChangeLegalBasis(annotation, canAddRedaction);
permissions.canRecategorizeAnnotation = canRecategorizeAnnotation(annotation, canAddRedaction); permissions.canRecategorizeAnnotation = canRecategorizeAnnotation(annotation, canAddRedaction);
permissions.canResizeAnnotation = canResizeAnnotation(annotation, canAddRedaction); permissions.canResizeAnnotation = canResizeAnnotation(annotation, canAddRedaction);

View File

@ -60,14 +60,7 @@ export class AnnotationActionsComponent implements OnChanges {
} }
get canRemoveRedaction(): boolean { get canRemoveRedaction(): boolean {
if (this.annotationPermissions.canRemoveRedaction) { return this.annotationPermissions.canRemoveRedaction && this.#sameType;
if (this.annotations.length > 1) {
const foundIgnoredHint = this.annotations.find(a => a.isIgnoredHint);
return !foundIgnoredHint && this.#sameType;
}
return true;
}
return false;
} }
get viewerAnnotations() { get viewerAnnotations() {
@ -78,6 +71,11 @@ export class AnnotationActionsComponent implements OnChanges {
return this.#annotations?.length === 1 && this.#annotations?.[0].id === this._annotationManager.resizingAnnotationId; return this.#annotations?.length === 1 && this.#annotations?.[0].id === this._annotationManager.resizingAnnotationId;
} }
get #sameType() {
const type = this.annotations[0].superType;
return this.annotations.every(a => a.superType === type);
}
constructor( constructor(
readonly viewModeService: ViewModeService, readonly viewModeService: ViewModeService,
readonly helpModeService: HelpModeService, readonly helpModeService: HelpModeService,
@ -126,6 +124,10 @@ export class AnnotationActionsComponent implements OnChanges {
return this.annotationActionsService.cancelResize(this.#annotations[0]); return this.annotationActionsService.cancelResize(this.#annotations[0]);
} }
helpModeKey(action: string) {
return this.#isDocumine ? `${action}_annotation` : '';
}
#setPermissions() { #setPermissions() {
this.annotationPermissions = AnnotationPermissions.forUser( this.annotationPermissions = AnnotationPermissions.forUser(
this._permissionsService.isApprover(this._state.dossier()), this._permissionsService.isApprover(this._state.dossier()),
@ -134,13 +136,4 @@ export class AnnotationActionsComponent implements OnChanges {
this._iqserPermissionsService, this._iqserPermissionsService,
); );
} }
helpModeKey(action: string) {
return this.#isDocumine ? `${action}_annotation` : '';
}
get #sameType() {
const type = this.annotations[0].superType;
return this.annotations.every(a => a.superType === type);
}
} }

View File

@ -26,6 +26,7 @@ export class PdfAnnotationActionsService {
get(annotations: AnnotationWrapper[]): IHeaderElement[] { get(annotations: AnnotationWrapper[]): IHeaderElement[] {
const availableActions: IHeaderElement[] = []; const availableActions: IHeaderElement[] = [];
const permissions = this.#getAnnotationsPermissions(annotations); const permissions = this.#getAnnotationsPermissions(annotations);
const sameType = annotations.every(a => a.type === annotations[0].type);
// you can only resize one annotation at a time // you can only resize one annotation at a time
if (permissions.canResizeAnnotation) { if (permissions.canResizeAnnotation) {
@ -95,7 +96,7 @@ export class PdfAnnotationActionsService {
availableActions.push(forceHintButton); availableActions.push(forceHintButton);
} }
if (permissions.canRemoveRedaction) { if (permissions.canRemoveRedaction && sameType) {
const removeRedactionButton = this.#getButton('trash', _('annotation-actions.remove-annotation.remove-redaction'), () => const removeRedactionButton = this.#getButton('trash', _('annotation-actions.remove-annotation.remove-redaction'), () =>
this.#annotationActionsService.removeRedaction(annotations, permissions), this.#annotationActionsService.removeRedaction(annotations, permissions),
); );

View File

@ -913,7 +913,7 @@
"assign-approver": "Assign Approver", "assign-approver": "Assign Approver",
"assign-me": "Assign To Me", "assign-me": "Assign To Me",
"assign-reviewer": "Assign User", "assign-reviewer": "Assign User",
"back-to-new": "Back to New", "back-to-new": "Move to New",
"bulk": { "bulk": {
"delete": "Delete Documents", "delete": "Delete Documents",
"reanalyse": "Analyze Documents" "reanalyse": "Analyze Documents"
@ -1005,7 +1005,7 @@
"title": "{length} {length, plural, one{document} other{documents}}" "title": "{length} {length, plural, one{document} other{documents}}"
}, },
"under-approval": "For Approval", "under-approval": "For Approval",
"under-review": "Back to In Progress", "under-review": "Move to In Progress",
"upload-files": "Drag & drop files anywhere..." "upload-files": "Drag & drop files anywhere..."
}, },
"dossier-permissions": "Dossier Permissions", "dossier-permissions": "Dossier Permissions",