Fix: dont lose permissions ui if owner changed from null (#5433)

This commit is contained in:
shamoon 2024-01-17 09:44:04 -08:00 committed by GitHub
parent ea632d0417
commit dc1918ad10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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 ||