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 5c527f860..661467505 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 @@ -164,8 +164,9 @@ export class FilePreviewScreenComponent implements OnInit { openManualRedactionDialog($event: ManualRedactionEntryWrapper) { this.ngZone.run(() => { - this._dialogRef = this._dialogService.openManualRedactionDialog($event, (response: ManualAnnotationResponse) => { + this._dialogRef = this._dialogService.openManualRedactionDialog($event, async (response: ManualAnnotationResponse) => { if (response?.annotationId) { + this.fileData.fileStatus = await this.appStateService.reloadActiveFile(); this._cleanupAndRedrawManualAnnotations(response.annotationId); } }); @@ -381,11 +382,12 @@ export class FilePreviewScreenComponent implements OnInit { }); } - annotationsChangedByReviewAction(annotation: AnnotationWrapper) { + async annotationsChangedByReviewAction(annotation: AnnotationWrapper) { const viewerAnnotation = this.activeViewer.annotManager.getAnnotationById(annotation.id); if (viewerAnnotation) { this.activeViewer.annotManager.deleteAnnotation(viewerAnnotation, true, true); } + this.fileData.fileStatus = await this.appStateService.reloadActiveFile(); this._cleanupAndRedrawManualAnnotations(annotation.id); } diff --git a/apps/red-ui/src/app/state/app-state.service.ts b/apps/red-ui/src/app/state/app-state.service.ts index 37b4e2f84..efcdcfdbc 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -186,6 +186,21 @@ export class AppStateService { return found ? found.files : []; } + async reloadActiveFile() { + const oldProcessedDate = this.activeFile.lastProcessed; + const activeFile = await this._statusControllerService.getFileStatus(this.activeProjectId, this.activeFileId).toPromise(); + + const activeFileWrapper = new FileStatusWrapper(activeFile, this._userService.getNameForId(activeFile.currentReviewer)); + this.activeProject.files = this.activeProject.files.map((file) => (file.fileId === activeFileWrapper.fileId ? activeFileWrapper : file)); + + this._computeStats(); + if (activeFileWrapper.lastProcessed !== oldProcessedDate) { + this.fileReanalysed.emit(activeFileWrapper); + } + this.fileChanged.emit(activeFileWrapper); + return activeFileWrapper; + } + async getFiles(project?: ProjectWrapper) { if (!project) { project = this.activeProject;