diff --git a/apps/red-ui/src/app/models/file/file-data.model.ts b/apps/red-ui/src/app/models/file/file-data.model.ts index cd1926b7f..a021afdb2 100644 --- a/apps/red-ui/src/app/models/file/file-data.model.ts +++ b/apps/red-ui/src/app/models/file/file-data.model.ts @@ -84,7 +84,7 @@ export class FileDataModel { } }); - this.redactionLog.redactionLogEntry.forEach((redactionLogEntry) => { + this.redactionLog.redactionLogEntry?.forEach((redactionLogEntry) => { // false positive entries from the redaction-log need to be skipped if (redactionLogEntry.type?.toLowerCase() === 'false_positive') { return; @@ -101,7 +101,7 @@ export class FileDataModel { result.push(redactionLogEntryWrapper); }); - this.manualRedactions.forceRedactions.forEach((forceRedaction) => { + this.manualRedactions.forceRedactions?.forEach((forceRedaction) => { const relevantRedactionLogEntry = result.find((r) => r.id === forceRedaction.id); if (forceRedaction.status === 'DECLINED') { @@ -126,7 +126,7 @@ export class FileDataModel { } }); - this.manualRedactions.entriesToAdd.forEach((manual) => { + this.manualRedactions.entriesToAdd?.forEach((manual) => { const markedAsReasonRedactionLogEntry = result.find((r) => r.id === manual.reason); const relevantRedactionLogEntry = result.find((r) => r.id === manual.id); @@ -187,7 +187,7 @@ export class FileDataModel { } }); - this.manualRedactions.idsToRemove.forEach((idToRemove) => { + this.manualRedactions.idsToRemove?.forEach((idToRemove) => { const relevantRedactionLogEntry = result.find((r) => r.id === idToRemove.id); if (!relevantRedactionLogEntry) { diff --git a/apps/red-ui/src/app/modules/projects/components/comments/comments.component.html b/apps/red-ui/src/app/modules/projects/components/comments/comments.component.html index e357c5b33..0696858b6 100644 --- a/apps/red-ui/src/app/modules/projects/components/comments/comments.component.html +++ b/apps/red-ui/src/app/modules/projects/components/comments/comments.component.html @@ -25,10 +25,14 @@ }) }} -
+
-
+
diff --git a/apps/red-ui/src/app/modules/projects/components/comments/comments.component.ts b/apps/red-ui/src/app/modules/projects/components/comments/comments.component.ts index 896aa5709..d8a0d5147 100644 --- a/apps/red-ui/src/app/modules/projects/components/comments/comments.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/comments/comments.component.ts @@ -6,6 +6,7 @@ import { AnnotationWrapper } from '../../../../models/file/annotation.wrapper'; import { UserService } from '../../../../services/user.service'; import { AppStateService } from '../../../../state/app-state.service'; import { TranslateService } from '@ngx-translate/core'; +import { PermissionsService } from '../../../../services/permissions.service'; @Component({ selector: 'redaction-comments', @@ -20,6 +21,7 @@ export class CommentsComponent { constructor( public readonly translateService: TranslateService, + public readonly permissionsService: PermissionsService, private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _appStateService: AppStateService, private readonly _formBuilder: FormBuilder, diff --git a/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts index 0cd21d5d9..e8baa44f4 100644 --- a/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts @@ -220,7 +220,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, const annotationFilters = this._annotationProcessingService.getAnnotationFilter(this.annotations); this.primaryFilters = processFilters(this.primaryFilters, annotationFilters); this.secondaryFilters = processFilters(this.secondaryFilters, AnnotationProcessingService.secondaryAnnotationFilters); - this._workloadComponent.filtersChanged({ + this._workloadComponent?.filtersChanged({ primary: this.primaryFilters, secondary: this.secondaryFilters }); diff --git a/apps/red-ui/src/app/modules/projects/services/pdf-viewer-data.service.ts b/apps/red-ui/src/app/modules/projects/services/pdf-viewer-data.service.ts index 8cee58bd0..e8e56661e 100644 --- a/apps/red-ui/src/app/modules/projects/services/pdf-viewer-data.service.ts +++ b/apps/red-ui/src/app/modules/projects/services/pdf-viewer-data.service.ts @@ -29,14 +29,15 @@ export class PdfViewerDataService { loadActiveFileData(): Observable { const fileObs = this.downloadOriginalFile(this._appStateService.activeFile); - const reactionLogObs = this._redactionLogControllerService.getRedactionLog(this._appStateService.activeProjectId, this._appStateService.activeFileId); + const reactionLogObs = this._redactionLogControllerService + .getRedactionLog(this._appStateService.activeProjectId, this._appStateService.activeFileId) + .pipe(catchError(() => of({}))); const redactionChangeLogObs = this._redactionLogControllerService .getRedactionChangeLog(this._appStateService.activeProjectId, this._appStateService.activeFileId) .pipe(catchError(() => of({}))); - const manualRedactionsObs = this._manualRedactionControllerService.getManualRedaction( - this._appStateService.activeProjectId, - this._appStateService.activeFileId - ); + const manualRedactionsObs = this._manualRedactionControllerService + .getManualRedaction(this._appStateService.activeProjectId, this._appStateService.activeFileId) + .pipe(catchError(() => of({}))); const viewedPagesObs = this.getViewedPagesForActiveFile(); return forkJoin([fileObs, reactionLogObs, redactionChangeLogObs, manualRedactionsObs, viewedPagesObs]).pipe( diff --git a/apps/red-ui/src/app/services/permissions.service.ts b/apps/red-ui/src/app/services/permissions.service.ts index 7addc4995..a431ba7b6 100644 --- a/apps/red-ui/src/app/services/permissions.service.ts +++ b/apps/red-ui/src/app/services/permissions.service.ts @@ -312,4 +312,14 @@ export class PermissionsService { canManageUsers(user?: UserWrapper) { return this.isUserAdmin(user); } + + canAddComment(fileStatus?: FileStatusWrapper) { + if (!fileStatus) { + fileStatus = this._appStateService.activeFile; + } + if (!fileStatus) { + return false; + } + return this.isFileReviewer(fileStatus) || this.isManagerAndOwner(); + } }