Fix: dont lose permissions ui if owner changed from null

This commit is contained in:
shamoon 2024-01-16 14:21:06 -08:00
parent ea632d0417
commit 8b0482d0ac

View File

@ -861,8 +861,11 @@ export class DocumentDetailComponent
get userIsOwner(): boolean { get userIsOwner(): boolean {
let doc: Document = Object.assign({}, this.document) let doc: Document = Object.assign({}, this.document)
// dont disable while editing // dont disable while editing
if (this.document && this.store?.value.permissions_form?.owner) { if (
doc.owner = this.store?.value.permissions_form?.owner this.document &&
this.store?.value.permissions_form?.hasOwnProperty('owner')
) {
doc.owner = this.store.value.permissions_form.owner
} }
return !this.document || this.permissionsService.currentUserOwnsObject(doc) return !this.document || this.permissionsService.currentUserOwnsObject(doc)
} }
@ -870,8 +873,11 @@ export class DocumentDetailComponent
get userCanEdit(): boolean { get userCanEdit(): boolean {
let doc: Document = Object.assign({}, this.document) let doc: Document = Object.assign({}, this.document)
// dont disable while editing // dont disable while editing
if (this.document && this.store?.value.permissions_form?.owner) { if (
doc.owner = this.store?.value.permissions_form?.owner this.document &&
this.store?.value.permissions_form?.hasOwnProperty('owner')
) {
doc.owner = this.store.value.permissions_form.owner
} }
return ( return (
!this.document || !this.document ||