]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: dont lose permissions ui if owner changed from null (#5433)
authorshamoon <4887959+shamoon@users.noreply.github.com>
Wed, 17 Jan 2024 17:44:04 +0000 (09:44 -0800)
committerGitHub <noreply@github.com>
Wed, 17 Jan 2024 17:44:04 +0000 (17:44 +0000)
src-ui/src/app/components/document-detail/document-detail.component.ts

index 0e79b3deb1c8cc2be263542adc91a19a9ab36ee2..798e867bf5dec7dad202ea173f0bc3704eb6c8bf 100644 (file)
@@ -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 ||