From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 3 Mar 2023 23:21:02 +0000 (-0800) Subject: Disable suggestions for read-only docs X-Git-Tag: v1.14.0-beta.rc1~66^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2813%2Fhead;p=thirdparty%2Fpaperless-ngx.git Disable suggestions for read-only docs --- diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index 33a0d41142..8103cc374b 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -306,20 +306,27 @@ export class DocumentDetailComponent ) }, }) - this.documentsService - .getSuggestions(doc.id) - .pipe(first()) - .subscribe({ - next: (result) => { - this.suggestions = result - }, - error: (error) => { - this.suggestions = null - this.toastService.showError( - $localize`Error retrieving suggestions` + ': ' + error.toString() - ) - }, - }) + if ( + this.permissionsService.currentUserHasObjectPermissions( + PermissionAction.Change, + doc + ) + ) { + this.documentsService + .getSuggestions(doc.id) + .pipe(first()) + .subscribe({ + next: (result) => { + this.suggestions = result + }, + error: (error) => { + this.suggestions = null + this.toastService.showError( + $localize`Error retrieving suggestions` + ': ' + error.toString() + ) + }, + }) + } this.title = this.documentTitlePipe.transform(doc.title) const docFormValues = Object.assign({}, doc) docFormValues['permissions_form'] = {