]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Retain doc changes on tab switch after refresh doc 3243/head
authorshamoon <4887959+shamoon@users.noreply.github.com>
Sat, 29 Apr 2023 07:05:05 +0000 (00:05 -0700)
committershamoon <4887959+shamoon@users.noreply.github.com>
Sat, 29 Apr 2023 07:23:30 +0000 (00:23 -0700)
src-ui/src/app/components/document-detail/document-detail.component.ts

index 9b23aa047663d3909d72760171b91742727a5f44..bcce59441c63da582c12c17c53606c4b9249f539 100644 (file)
@@ -236,10 +236,21 @@ export class DocumentDetailComponent
             true
           )
           this.suggestions = null
-          if (this.openDocumentService.getOpenDocument(this.documentId)) {
-            this.updateComponent(
-              this.openDocumentService.getOpenDocument(this.documentId)
-            )
+          const openDocument = this.openDocumentService.getOpenDocument(
+            this.documentId
+          )
+          if (openDocument) {
+            if (this.documentForm.dirty) {
+              Object.assign(openDocument, this.documentForm.value)
+              openDocument['owner'] =
+                this.documentForm.get('permissions_form').value['owner']
+              openDocument['permissions'] =
+                this.documentForm.get('permissions_form').value[
+                  'set_permissions'
+                ]
+              delete openDocument['permissions_form']
+            }
+            this.updateComponent(openDocument)
           } else {
             this.openDocumentService.openDocument(doc)
             this.updateComponent(doc)