handling server 404 and comments permissions
This commit is contained in:
parent
467a476c52
commit
26fea48edc
@ -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) {
|
||||
|
||||
@ -25,10 +25,14 @@
|
||||
})
|
||||
}}
|
||||
</div>
|
||||
<div (click)="toggleAddingComment($event)" *ngIf="!addingComment && canAddComment" translate="comments.add-comment"></div>
|
||||
<div
|
||||
(click)="toggleAddingComment($event)"
|
||||
*ngIf="!addingComment && canAddComment && permissionsService.canAddComment()"
|
||||
translate="comments.add-comment"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<form (submit)="addComment()" *ngIf="addingComment" [formGroup]="commentForm">
|
||||
<form (submit)="addComment()" *ngIf="addingComment && permissionsService.canAddComment()" [formGroup]="commentForm">
|
||||
<div class="red-input-group">
|
||||
<input [placeholder]="translateService.instant('comments.add-comment')" formControlName="comment" name="comment" type="text" class="w-full" />
|
||||
</div>
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
});
|
||||
|
||||
@ -29,14 +29,15 @@ export class PdfViewerDataService {
|
||||
|
||||
loadActiveFileData(): Observable<FileDataModel> {
|
||||
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(
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user