comment permissions - RED-1867
This commit is contained in:
parent
ddb909c56c
commit
732533d533
@ -7,7 +7,7 @@
|
||||
<div class="comment-actions">
|
||||
<redaction-circle-button
|
||||
(action)="deleteComment(comment)"
|
||||
*ngIf="isCommentOwner(comment)"
|
||||
*ngIf="permissionsService.canDeleteComment(comment)"
|
||||
[iconSize]="10"
|
||||
[size]="20"
|
||||
class="pointer"
|
||||
|
||||
@ -60,10 +60,6 @@ export class CommentsComponent {
|
||||
});
|
||||
}
|
||||
|
||||
isCommentOwner(comment: Comment): boolean {
|
||||
return comment.user === this._userService.userId;
|
||||
}
|
||||
|
||||
getOwnerName(comment: Comment): string {
|
||||
return this._userService.getNameForId(comment.user);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { UserService, UserWrapper } from './user.service';
|
||||
import { FileStatusWrapper } from '@models/file/file-status.wrapper';
|
||||
import { User } from '@redaction/red-ui-http';
|
||||
import { User, Comment } from '@redaction/red-ui-http';
|
||||
import { DossierWrapper } from '@state/model/dossier.wrapper';
|
||||
|
||||
@Injectable({
|
||||
@ -182,10 +182,14 @@ export class PermissionsService {
|
||||
}
|
||||
|
||||
canAddComment(fileStatus = this._activeFile): boolean {
|
||||
return this.isFileReviewer(fileStatus) || this.isApprover();
|
||||
return (this.isFileReviewer(fileStatus) || this.isApprover()) && !fileStatus.isApproved;
|
||||
}
|
||||
|
||||
canExcludePages(fileStatus = this._activeFile): boolean {
|
||||
return ['UNDER_REVIEW', 'UNDER_APPROVAL'].includes(fileStatus.status) && (this.isFileReviewer(fileStatus) || this.isApprover());
|
||||
}
|
||||
|
||||
canDeleteComment(comment: Comment, fileStatus = this._activeFile) {
|
||||
return (comment.user === this._userService.userId || this.isApprover()) && !fileStatus.isApproved;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user