From cf3645c296a00c885222f201f66f07bd9e6a6b5a Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Tue, 8 Oct 2024 12:47:37 -0700 Subject: [PATCH 1/4] Fixes the ASN checking to allow an ASN of 0 (#7878) --- src/documents/consumer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/documents/consumer.py b/src/documents/consumer.py index 803d82510..f79d3f9c3 100644 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -348,7 +348,7 @@ class ConsumerPlugin( """ Check that if override_asn is given, it is unique and within a valid range """ - if not self.metadata.asn: + if self.metadata.asn is None: # check not necessary in case no ASN gets set return # Validate the range is above zero and less than uint32_t max @@ -905,7 +905,7 @@ class ConsumerPlugin( pk=self.metadata.storage_path_id, ) - if self.metadata.asn: + if self.metadata.asn is not None: document.archive_serial_number = self.metadata.asn if self.metadata.owner_id: From 8dd355f6bf746b5ce99091eb10fc802b661b67e3 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 8 Oct 2024 23:36:09 -0700 Subject: [PATCH 2/4] Chore: fix test comments --- src/documents/tests/test_workflows.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/documents/tests/test_workflows.py b/src/documents/tests/test_workflows.py index c410f76a2..c5d975958 100644 --- a/src/documents/tests/test_workflows.py +++ b/src/documents/tests/test_workflows.py @@ -306,11 +306,11 @@ class TestWorkflows(DirectoriesMixin, FileSystemAssertsMixin, APITestCase): def test_workflow_match_multiple(self): """ GIVEN: - - Multiple existing workflow + - Multiple existing workflows WHEN: - File that matches is consumed THEN: - - Template overrides are applied with subsequent templates overwriting previous values + - Workflow overrides are applied with subsequent workflows overwriting previous values or merging if multiple """ trigger1 = WorkflowTrigger.objects.create( @@ -373,12 +373,12 @@ class TestWorkflows(DirectoriesMixin, FileSystemAssertsMixin, APITestCase): None, ) document = Document.objects.first() - # template 1 + # workflow 1 self.assertEqual(document.document_type, self.dt) - # template 2 + # workflow 2 self.assertEqual(document.correspondent, self.c2) self.assertEqual(document.storage_path, self.sp) - # template 1 & 2 + # workflow 1 & 2 self.assertEqual( list(document.tags.all()), [self.t1, self.t2, self.t3], From 024b60638afd94c7a34cb50e254d193c9f7b30cc Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:35:36 -0700 Subject: [PATCH 3/4] Feature: live preview of storage path (#7870) --- src-ui/messages.xlf | 92 ++++++++------ .../storage-path-edit-dialog.component.html | 52 +++++++- .../storage-path-edit-dialog.component.scss | 4 + ...storage-path-edit-dialog.component.spec.ts | 96 ++++++++++++++- .../storage-path-edit-dialog.component.ts | 115 ++++++++++++++++-- .../workflow-edit-dialog.component.scss | 4 + .../input/textarea/textarea.component.html | 2 +- .../rest/storage-path.service.spec.ts | 28 +++++ .../app/services/rest/storage-path.service.ts | 8 ++ src-ui/src/styles.scss | 7 +- src/documents/serialisers.py | 15 +++ src/documents/templating/filepath.py | 1 - src/documents/tests/test_api_objects.py | 29 +++++ src/documents/views.py | 21 ++++ src/paperless/urls.py | 6 + 15 files changed, 426 insertions(+), 54 deletions(-) diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf index 7838c63ed..8a7d70981 100644 --- a/src-ui/messages.xlf +++ b/src-ui/messages.xlf @@ -568,7 +568,7 @@ src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html - 29 + 79 src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.html @@ -700,6 +700,10 @@ src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.html 35 + + src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html + 50 + src/app/components/common/input/document-link/document-link.component.html 51 @@ -1680,7 +1684,7 @@ src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html - 28 + 78 src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.html @@ -3500,7 +3504,7 @@ src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html - 14 + 64 src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.html @@ -3519,7 +3523,7 @@ src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html - 16 + 66 src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.html @@ -3538,7 +3542,7 @@ src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html - 19 + 69 src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.html @@ -4126,39 +4130,72 @@ 42 - - e.g. + + See <a target='_blank' href='https://docs.paperless-ngx.com/advanced_usage/#file-name-handling'>the documentation</a>. - src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.ts - 28 + src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html + 13 - - or use slashes to add directories e.g. + + Preview - src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.ts + src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html + 18 + + + src/app/components/document-detail/document-detail.component.html + 282 + + + + Path test failed + + src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html 30 - - See <a target="_blank" href="https://docs.paperless-ngx.com/advanced_usage/#file-name-handling">documentation</a> for full list. + + No document selected - src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.ts + src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html 32 + + Search for documents + + src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html + 38 + + + src/app/components/common/input/document-link/document-link.component.ts + 53 + + + + No documents found + + src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html + 39 + + + src/app/components/common/input/document-link/document-link.component.ts + 44 + + Create new storage path src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.ts - 37 + 63 Edit storage path src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.ts - 41 + 67 @@ -4836,20 +4873,6 @@ 14 - - No documents found - - src/app/components/common/input/document-link/document-link.component.ts - 44 - - - - Search for documents - - src/app/components/common/input/document-link/document-link.component.ts - 53 - - Selected items @@ -6120,13 +6143,6 @@ 275 - - Preview - - src/app/components/document-detail/document-detail.component.html - 282 - - Notes diff --git a/src-ui/src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html index f8232f957..45b2bc5e9 100644 --- a/src-ui/src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html +++ b/src-ui/src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html @@ -10,7 +10,57 @@