From dc1918ad10436bc05f519f588ae60c4b5204763f Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 17 Jan 2024 09:44:04 -0800 Subject: [PATCH] Fix: dont lose permissions ui if owner changed from null (#5433) --- .../document-detail/document-detail.component.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 0e79b3deb..798e867bf 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 @@ -861,8 +861,11 @@ export class DocumentDetailComponent get userIsOwner(): boolean { let doc: Document = Object.assign({}, this.document) // dont disable while editing - if (this.document && this.store?.value.permissions_form?.owner) { - doc.owner = this.store?.value.permissions_form?.owner + if ( + this.document && + this.store?.value.permissions_form?.hasOwnProperty('owner') + ) { + doc.owner = this.store.value.permissions_form.owner } return !this.document || this.permissionsService.currentUserOwnsObject(doc) } @@ -870,8 +873,11 @@ export class DocumentDetailComponent get userCanEdit(): boolean { let doc: Document = Object.assign({}, this.document) // dont disable while editing - if (this.document && this.store?.value.permissions_form?.owner) { - doc.owner = this.store?.value.permissions_form?.owner + if ( + this.document && + this.store?.value.permissions_form?.hasOwnProperty('owner') + ) { + doc.owner = this.store.value.permissions_form.owner } return ( !this.document ||