diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html
index c93edcf27..67978c341 100644
--- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html
+++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html
@@ -107,7 +107,7 @@
diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts
index e08c31d30..95f2edb40 100644
--- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts
+++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts
@@ -367,28 +367,23 @@ export class FilePreviewScreenComponent implements OnInit {
}
}
- private _cleanupAndRedrawManualAnnotations() {
+ private _cleanupAndRedrawManualAnnotations(singleAnnotation: AnnotationWrapper) {
this._fileDownloadService.loadActiveFileManualAnnotations().subscribe((manualRedactions) => {
- const annotationsToRemove = [];
- const previouslyDrawnAnnotations = this.annotations.filter((a) => a.shouldDraw);
- previouslyDrawnAnnotations.forEach((annotationWrapper) => {
- const annotation = this.activeViewer.annotManager.getAnnotationById(annotationWrapper.id);
- if (annotation) {
- annotationsToRemove.push(annotation);
- }
- });
- this.activeViewer.annotManager.deleteAnnotations(annotationsToRemove, false, true);
this.fileData.manualRedactions = manualRedactions;
this._rebuildFilters();
this._annotationDrawService.drawAnnotations(
this.instance,
- this.annotations.filter((a) => a.shouldDraw)
+ this.annotations.filter((item) => (singleAnnotation ? singleAnnotation.id === item.id && singleAnnotation.shouldDraw : item.shouldDraw))
);
});
}
- annotationsChangedByReviewAction() {
- this._cleanupAndRedrawManualAnnotations();
+ annotationsChangedByReviewAction(annotation: AnnotationWrapper) {
+ const viewerAnnotation = this.activeViewer.annotManager.getAnnotationById(annotation.id);
+ if (viewerAnnotation) {
+ this.activeViewer.annotManager.deleteAnnotation(viewerAnnotation, true, true);
+ }
+ this._cleanupAndRedrawManualAnnotations(annotation);
}
async fileActionPerformed(action: string) {
@@ -406,6 +401,4 @@ export class FilePreviewScreenComponent implements OnInit {
this.canPerformAnnotationActions = this.permissionsService.canPerformAnnotationActions();
await this.appStateService.reloadActiveProjectFiles();
}
-
- // allManualRedactionsApplied
}
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 222f5b2af..86d04ae0d 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
@@ -41,8 +41,15 @@ export class AnnotationWrapper {
const annotationWrapper = new AnnotationWrapper();
annotationWrapper.comments = comments ? comments : [];
-
+ annotationWrapper.shouldDraw = true;
if (redactionLogEntry) {
+ if (redactionLogEntry.manual) {
+ if (!manualRedactionEntry && redactionLogEntry.manualRedactionType === 'ADD') {
+ // do not draw if it is no longer in the manual redactions
+ annotationWrapper.shouldDraw = false;
+ }
+ }
+
annotationWrapper.id = redactionLogEntry.id;
annotationWrapper.redaction = redactionLogEntry.redacted;
annotationWrapper.hint = redactionLogEntry.hint;
@@ -52,30 +59,10 @@ export class AnnotationWrapper {
annotationWrapper.positions = redactionLogEntry.positions;
annotationWrapper.content = AnnotationWrapper.createContentForRedactionLog(redactionLogEntry);
// either marked as manual or idRemove or manualRedactionEntry exists
- annotationWrapper.manual = redactionLogEntry.manual || !!manualRedactionEntry || !!idRemoval;
+ annotationWrapper.manual = redactionLogEntry.manual;
+ annotationWrapper.canUndo = manualRedactionEntry?.user === user.id || idRemoval?.user === user.id;
annotationWrapper.modifyDictionary = !!manualRedactionEntry?.addToDictionary || !!idRemoval?.removeFromDictionary;
- switch (redactionLogEntry.status) {
- case 'REQUESTED':
- annotationWrapper.superType = idRemoval?.status === 'REQUESTED' || idRemoval?.status === 'APPROVED' ? 'suggestion-remove' : 'suggestion';
- break;
- case 'APPROVED':
- annotationWrapper.superType = annotationWrapper.redaction ? 'redaction' : annotationWrapper.hint ? 'hint' : 'ignore';
- break;
- case 'DECLINED':
- // TODO check this
- annotationWrapper.superType = 'ignore';
- break;
- default:
- annotationWrapper.superType =
- idRemoval?.status === 'REQUESTED' || idRemoval?.status === 'APPROVED'
- ? 'suggestion-remove'
- : annotationWrapper.redaction
- ? 'redaction'
- : annotationWrapper.hint
- ? 'hint'
- : 'ignore';
- break;
- }
+ AnnotationWrapper._setSuperType(annotationWrapper, redactionLogEntry, manualRedactionEntry, idRemoval);
} else {
const dictionary = dictionaryData[manualRedactionEntry.type];
annotationWrapper.id = manualRedactionEntry.id;
@@ -90,30 +77,8 @@ export class AnnotationWrapper {
annotationWrapper.comments = comments[manualRedactionEntry.id] ? comments[manualRedactionEntry.id] : [];
annotationWrapper.userId = manualRedactionEntry.user;
annotationWrapper.canUndo = manualRedactionEntry?.user === user.id;
- annotationWrapper.shouldDraw = AnnotationWrapper._shouldDraw(manualRedactionEntry, fileStatus);
annotationWrapper.modifyDictionary = manualRedactionEntry.addToDictionary;
- switch (manualRedactionEntry.status) {
- case 'REQUESTED':
- annotationWrapper.superType = idRemoval?.status === 'REQUESTED' || idRemoval?.status === 'APPROVED' ? 'suggestion-remove' : 'suggestion';
- break;
- case 'APPROVED':
- annotationWrapper.superType = redactionLogEntry.redacted ? 'redaction' : redactionLogEntry.hint ? 'hint' : 'ignore';
- break;
- case 'DECLINED':
- // TODO check this
- annotationWrapper.superType = 'ignore';
- break;
- default:
- annotationWrapper.superType =
- idRemoval?.status === 'REQUESTED' || idRemoval?.status === 'APPROVED'
- ? 'suggestion-remove'
- : annotationWrapper.redaction
- ? 'redaction'
- : annotationWrapper.hint
- ? 'hint'
- : 'ignore';
- break;
- }
+ AnnotationWrapper._setSuperType(annotationWrapper, redactionLogEntry, manualRedactionEntry, idRemoval);
}
AnnotationWrapper._setTypeLabel(annotationWrapper);
@@ -121,14 +86,31 @@ export class AnnotationWrapper {
return annotationWrapper;
}
- private static _shouldDraw(manualRedaction: ManualRedactionEntry, fileStatus: FileStatus): boolean {
- const isRequested =
- manualRedaction.status === 'REQUESTED' && new Date(manualRedaction.requestDate).getTime() > new Date(fileStatus.lastProcessed).getTime();
- const isApprovedOrDeclined =
- (manualRedaction.status === 'APPROVED' || manualRedaction.status === 'DECLINED') &&
- new Date(manualRedaction.requestDate).getTime() > new Date(fileStatus.lastProcessed).getTime();
-
- return isRequested || isApprovedOrDeclined;
+ private static _setSuperType(
+ annotationWrapper: AnnotationWrapper,
+ redactionLogEntry?: RedactionLogEntry,
+ manualRedactionEntry?: ManualRedactionEntry,
+ idRemoval?: IdRemoval
+ ) {
+ if (idRemoval) {
+ if (idRemoval.status === 'REQUESTED') {
+ annotationWrapper.superType = 'suggestion-remove';
+ }
+ if (idRemoval.status === 'APPROVED') {
+ annotationWrapper.superType = 'ignore';
+ }
+ }
+ if (manualRedactionEntry) {
+ if (manualRedactionEntry.status === 'REQUESTED') {
+ annotationWrapper.superType = 'suggestion';
+ }
+ if (manualRedactionEntry.status === 'APPROVED') {
+ annotationWrapper.superType = annotationWrapper.redaction ? 'redaction' : annotationWrapper.hint ? 'hint' : 'ignore';
+ }
+ }
+ if (!annotationWrapper.superType) {
+ annotationWrapper.superType = annotationWrapper.redaction ? 'redaction' : annotationWrapper.hint ? 'hint' : 'ignore';
+ }
}
private static _setTypeLabel(annotationWrapper: AnnotationWrapper) {
diff --git a/apps/red-ui/src/app/screens/file/model/file-data.model.ts b/apps/red-ui/src/app/screens/file/model/file-data.model.ts
index ed841df3e..61981343d 100644
--- a/apps/red-ui/src/app/screens/file/model/file-data.model.ts
+++ b/apps/red-ui/src/app/screens/file/model/file-data.model.ts
@@ -39,7 +39,9 @@ export class FileDataModel {
pair.idRemoval,
pair.comments
);
- annotations.push(annotation);
+ if (annotation) {
+ annotations.push(annotation);
+ }
});
return annotations;
diff --git a/apps/red-ui/src/app/screens/file/service/annotation-processing.service.ts b/apps/red-ui/src/app/screens/file/service/annotation-processing.service.ts
index 2799479f1..8e198148c 100644
--- a/apps/red-ui/src/app/screens/file/service/annotation-processing.service.ts
+++ b/apps/red-ui/src/app/screens/file/service/annotation-processing.service.ts
@@ -46,10 +46,7 @@ export class AnnotationProcessingService {
return filters.sort((a, b) => SuperTypeSorter[a.key] - SuperTypeSorter[b.key]);
}
- filterAndGroupAnnotations(
- annotations: AnnotationWrapper[],
- filters: FilterModel[]
- ): { [key: number]: { annotations: AnnotationWrapper[] } } {
+ filterAndGroupAnnotations(annotations: AnnotationWrapper[], filters: FilterModel[]): { [key: number]: { annotations: AnnotationWrapper[] } } {
const obj = {};
const hasActiveFilters = this._hasActiveFilters(filters);
@@ -68,9 +65,7 @@ export class AnnotationProcessingService {
for (const filter of flatFilters) {
if (
filter.checked &&
- ((filter.key === annotation.dictionary &&
- (annotation.superType === 'hint' ||
- annotation.superType === 'redaction')) ||
+ ((filter.key === annotation.dictionary && (annotation.superType === 'hint' || annotation.superType === 'redaction')) ||
filter.key === annotation.superType)
) {
found = true;
diff --git a/apps/red-ui/src/app/screens/file/service/file-download.service.ts b/apps/red-ui/src/app/screens/file/service/file-download.service.ts
index d65e149e2..5687c3872 100644
--- a/apps/red-ui/src/app/screens/file/service/file-download.service.ts
+++ b/apps/red-ui/src/app/screens/file/service/file-download.service.ts
@@ -30,7 +30,7 @@ export class FileDownloadService {
}
public loadActiveFileData(): Observable {
- const annotatedObs = this.loadFile('ANNOTATED', this._appStateService.activeFileId);
+ const annotatedObs = this.loadFile('ORIGINAL', this._appStateService.activeFileId);
const redactedObs = this.loadFile('REDACTED', this._appStateService.activeFileId);
const reactionLogObs = this._redactionLogControllerService.getRedactionLog(this._appStateService.activeFileId);
const manualRedactionsObs = this._manualRedactionControllerService.getManualRedaction(
diff --git a/libs/red-ui-http/src/lib/model/redactionLogEntry.ts b/libs/red-ui-http/src/lib/model/redactionLogEntry.ts
index d32d11772..cd2342b33 100644
--- a/libs/red-ui-http/src/lib/model/redactionLogEntry.ts
+++ b/libs/red-ui-http/src/lib/model/redactionLogEntry.ts
@@ -20,6 +20,7 @@ export interface RedactionLogEntry {
positions?: Array;
reason?: string;
redacted?: boolean;
+ manualRedactionType?: string;
section?: string;
sectionNumber?: number;
status?: RedactionLogEntry.StatusEnum;