Merge pull request #2813 from paperless-ngx/fix-2811

Fix: Disable suggestions for read-only docs
This commit is contained in:
shamoon 2023-03-03 15:36:43 -08:00 committed by GitHub
commit f0fa726e71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -306,20 +306,27 @@ export class DocumentDetailComponent
) )
}, },
}) })
this.documentsService if (
.getSuggestions(doc.id) this.permissionsService.currentUserHasObjectPermissions(
.pipe(first()) PermissionAction.Change,
.subscribe({ doc
next: (result) => { )
this.suggestions = result ) {
}, this.documentsService
error: (error) => { .getSuggestions(doc.id)
this.suggestions = null .pipe(first())
this.toastService.showError( .subscribe({
$localize`Error retrieving suggestions` + ': ' + error.toString() 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) this.title = this.documentTitlePipe.transform(doc.title)
const docFormValues = Object.assign({}, doc) const docFormValues = Object.assign({}, doc)
docFormValues['permissions_form'] = { docFormValues['permissions_form'] = {