Disable suggestions for read-only docs

This commit is contained in:
shamoon 2023-03-03 15:21:02 -08:00
parent ef627d53e5
commit ae46ef7add

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'] = {