diff --git a/apps/red-ui/src/app/common/service/permissions.service.ts b/apps/red-ui/src/app/common/service/permissions.service.ts
index 58b079416..302f51e02 100644
--- a/apps/red-ui/src/app/common/service/permissions.service.ts
+++ b/apps/red-ui/src/app/common/service/permissions.service.ts
@@ -15,6 +15,10 @@ export class PermissionsService {
return this._userService.user;
}
+ get currentUserId() {
+ return this._userService.userId;
+ }
+
public isManager(user?: User) {
return this._userService.isManager();
}
diff --git a/apps/red-ui/src/app/components/type-annotation-icon/type-annotation-icon.component.ts b/apps/red-ui/src/app/components/type-annotation-icon/type-annotation-icon.component.ts
index 724085acc..7479b0cca 100644
--- a/apps/red-ui/src/app/components/type-annotation-icon/type-annotation-icon.component.ts
+++ b/apps/red-ui/src/app/components/type-annotation-icon/type-annotation-icon.component.ts
@@ -23,7 +23,9 @@ export class TypeAnnotationIconComponent implements OnChanges {
? this._appStateService.getDictionaryColor('suggestion-dictionary')
: this._appStateService.getDictionaryColor('suggestion');
} else {
- this.color = this._appStateService.getDictionaryColor(this.annotation.dictionary);
+ this.color = this.annotation.isIgnored
+ ? this._appStateService.getDictionaryColor('ignore')
+ : this._appStateService.getDictionaryColor(this.annotation.dictionary);
}
this.type = this.annotation.isSuggestion ? 'rhombus' : this.annotation.isRedactedOrIgnored ? 'square' : 'circle';
this.label = this.annotation.isSuggestion ? 'S' : this.annotation.isIgnored ? 'I' : this.annotation.dictionary[0].toUpperCase();
diff --git a/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.html b/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.html
index 65aef3bfe..fadb3dde4 100644
--- a/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.html
+++ b/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.html
@@ -1,73 +1,45 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.ts b/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.ts
index 3afc61a3d..0e7890729 100644
--- a/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.ts
+++ b/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.ts
@@ -18,7 +18,7 @@ export class AnnotationActionsComponent implements OnInit {
@Output() annotationsChanged = new EventEmitter();
suggestionType: TypeValue;
- menuType: 'APPROVE' | 'SUGGEST-REMOVE';
+ menuOpen: boolean;
constructor(
public appStateService: AppStateService,
@@ -65,12 +65,19 @@ export class AnnotationActionsComponent implements OnInit {
);
}
- public openMenu($event: MouseEvent, menuType: 'APPROVE' | 'SUGGEST-REMOVE') {
+ public openMenu($event: MouseEvent) {
$event.preventDefault();
- this.menuType = menuType;
+ this.menuOpen = true;
}
public onMenuClosed() {
- this.menuType = null;
+ this.menuOpen = false;
+ }
+
+ canUndoAnnotation() {
+ const isSuggestionOfCurrentUser = this.annotation.isSuggestion && this.annotation.userId === this.permissionsService.currentUserId;
+ const isManualAnnotationOfCurrentUser =
+ this.annotation.manual && this.annotation.userId === this.permissionsService.currentUserId && this.permissionsService.isManagerAndOwner();
+ return isSuggestionOfCurrentUser || isManualAnnotationOfCurrentUser;
}
}
diff --git a/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts b/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts
index cdc5eb59e..a6e103219 100644
--- a/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts
+++ b/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts
@@ -1,4 +1,4 @@
-import { Comment, FileStatus, IdRemoval, ManualRedactionEntry, Point, Rectangle, RedactionLogEntry, TypeValue } from '@redaction/red-ui-http';
+import { Comment, IdRemoval, ManualRedactionEntry, Point, Rectangle, RedactionLogEntry, TypeValue } from '@redaction/red-ui-http';
import { UserWrapper } from '../../../user/user.service';
import { FileStatusWrapper } from './file-status.wrapper';
@@ -20,7 +20,6 @@ export class AnnotationWrapper {
content: string;
manual: boolean;
userId: string;
- canUndo: boolean;
modifyDictionary: boolean;
typeLabel: string;
pageNumber: number;
@@ -54,6 +53,8 @@ export class AnnotationWrapper {
annotationWrapper.comments = comments ? comments : [];
annotationWrapper.shouldDraw = true;
+ annotationWrapper.userId = manualRedactionEntry?.user || idRemoval?.user;
+
if (redactionLogEntry) {
if (redactionLogEntry.manual) {
if (!manualRedactionEntry && redactionLogEntry.manualRedactionType === 'ADD') {
@@ -69,10 +70,9 @@ export class AnnotationWrapper {
annotationWrapper.firstTopLeftPoint = redactionLogEntry.positions[0]?.topLeft;
annotationWrapper.pageNumber = redactionLogEntry.positions[0]?.page;
annotationWrapper.positions = redactionLogEntry.positions;
- annotationWrapper.content = AnnotationWrapper.createContentForRedactionLog(redactionLogEntry);
+ annotationWrapper.content = AnnotationWrapper.createContent(redactionLogEntry);
// either marked as manual or idRemove or manualRedactionEntry exists
annotationWrapper.manual = redactionLogEntry.manual;
- annotationWrapper.canUndo = manualRedactionEntry?.user === user.id || idRemoval?.user === user.id;
annotationWrapper.modifyDictionary = !!manualRedactionEntry?.addToDictionary || !!idRemoval?.removeFromDictionary;
AnnotationWrapper._setSuperType(annotationWrapper, redactionLogEntry, manualRedactionEntry, idRemoval);
} else {
@@ -84,11 +84,10 @@ export class AnnotationWrapper {
annotationWrapper.firstTopLeftPoint = manualRedactionEntry.positions[0]?.topLeft;
annotationWrapper.pageNumber = manualRedactionEntry.positions[0]?.page;
annotationWrapper.positions = manualRedactionEntry.positions;
- annotationWrapper.content = manualRedactionEntry.addToDictionary ? null : AnnotationWrapper.createContentForManualRedaction(manualRedactionEntry);
+ annotationWrapper.content = manualRedactionEntry.addToDictionary ? null : AnnotationWrapper.createContent(manualRedactionEntry);
annotationWrapper.manual = true;
annotationWrapper.comments = comments[manualRedactionEntry.id] ? comments[manualRedactionEntry.id] : [];
annotationWrapper.userId = manualRedactionEntry.user;
- annotationWrapper.canUndo = manualRedactionEntry?.user === user.id;
annotationWrapper.modifyDictionary = manualRedactionEntry.addToDictionary;
AnnotationWrapper._setSuperType(annotationWrapper, redactionLogEntry, manualRedactionEntry, idRemoval);
}
@@ -154,13 +153,17 @@ export class AnnotationWrapper {
return this.firstTopLeftPoint.y;
}
- private static createContentForRedactionLog(entry: RedactionLogEntry) {
- if (entry.redacted) {
- return entry.reason + '\n\nLegal basis:' + entry.legalBasis + '\n\nIn section: "' + entry.section + '"';
+ private static createContent(entry: any) {
+ let content = '';
+ if (entry.reason) {
+ content += entry.reason + '\n\n';
}
- }
-
- private static createContentForManualRedaction(entry: ManualRedactionEntry) {
- return entry.reason + '\n\nLegal basis:' + entry.legalBasis;
+ if (entry.legalBasis) {
+ content += 'Legal basis:' + entry.legalBasis + '\n\n';
+ }
+ if (entry.section) {
+ content += 'In section: "' + entry.section + '"';
+ }
+ return content;
}
}