From 7f3a0168c37d5b3fa60eaba5f666f73412b58006 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Sun, 8 Nov 2020 22:27:00 +0200 Subject: [PATCH] modified allowed actions flow --- .../red-ui/src/app/state/app-state.service.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) 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 9762fc6a2..9464140cf 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -245,9 +245,7 @@ export class AppStateService { } get canMarkPagesAsViewedForActiveFile() { - return ( - this.activeFile.status === 'UNDER_APPROVAL' || this.activeFile.status === 'UNDER_REVIEW' - ); + return this.canPerformAnnotationActionsOnCurrentFile(); } public getProjectById(id: string) { @@ -602,13 +600,18 @@ export class AppStateService { } canPerformAnnotationActionsOnCurrentFile() { - const status = this.activeFile.status; - if (status === 'UNDER_REVIEW') { - return this.isActiveProjectOwnerAndManager || this.isActiveFileDocumentReviewer; - } - if (status === 'UNDER_APPROVAL') { - return this.isActiveProjectOwnerAndManager; - } - return false; + // const status = this.activeFile.status; + // if (status === 'UNDER_REVIEW') { + // return this.isActiveProjectOwnerAndManager || this.isActiveFileDocumentReviewer; + // } + // if (status === 'UNDER_APPROVAL') { + // return this.isActiveProjectOwnerAndManager; + // } + // return false; + return ( + (this.activeFile.status === 'UNDER_APPROVAL' || + this.activeFile.status === 'UNDER_REVIEW') && + this._userService.userId === this.activeFile.currentReviewer + ); } }