From c808011b75abe61e47a69003f7e951cb10491bb3 Mon Sep 17 00:00:00 2001 From: Jonas Winkler <17569239+jonaswinkler@users.noreply.github.com> Date: Wed, 20 Jan 2021 11:37:32 +0100 Subject: [PATCH 01/19] Update Crowdin configuration file --- crowdin.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 crowdin.yml diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 000000000..6291aa2b0 --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,5 @@ +files: + - source: /src/documents/locale/en-us/LC_MESSAGES/django.po + translation: /src/documents/locale/%two_letters_code%/LC_MESSAGES/django.po + - source: /src-ui/messages.xlf + translation: /src-ui/src/locale/messages.%two_letters_code%.xlf From f06edebbd863fdcfbf63f74badf4ac3c9a20f922 Mon Sep 17 00:00:00 2001 From: Jonas Winkler <17569239+jonaswinkler@users.noreply.github.com> Date: Wed, 20 Jan 2021 11:39:20 +0100 Subject: [PATCH 02/19] Update Crowdin configuration file --- crowdin.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crowdin.yml b/crowdin.yml index 6291aa2b0..f5a7765dd 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,5 +1,5 @@ files: - - source: /src/documents/locale/en-us/LC_MESSAGES/django.po - translation: /src/documents/locale/%two_letters_code%/LC_MESSAGES/django.po + - source: /src/locale/en-us/LC_MESSAGES/django.po + translation: /src/locale/%two_letters_code%/LC_MESSAGES/django.po - source: /src-ui/messages.xlf translation: /src-ui/src/locale/messages.%two_letters_code%.xlf From 08046cb83f95dbcb9ebe9bba37d8d2a9c77c0b67 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Wed, 20 Jan 2021 11:56:09 +0100 Subject: [PATCH 03/19] revert changes for #351 --- .../management/commands/document_consumer.py | 41 ++----------------- .../tests/test_management_consumer.py | 27 +----------- 2 files changed, 5 insertions(+), 63 deletions(-) diff --git a/src/documents/management/commands/document_consumer.py b/src/documents/management/commands/document_consumer.py index 595bd39cd..690f5299a 100644 --- a/src/documents/management/commands/document_consumer.py +++ b/src/documents/management/commands/document_consumer.py @@ -70,31 +70,6 @@ def _consume(filepath): "Error while consuming document: {}".format(e)) -def _test_inotify(directory): - if not INotify: - return False - - test_file = os.path.join(directory, "__inotify_test_file__") - inotify = INotify() - descriptor = None - try: - inotify_flags = flags.CLOSE_WRITE | flags.MOVED_TO - descriptor = inotify.add_watch(directory, inotify_flags) - Path(test_file).touch() - events = inotify.read(timeout=1000) - return len(events) == 1 - except Exception as e: - logger.warning( - f"Error while checking inotify availability: {str(e)}") - return False - finally: - if descriptor: - inotify.rm_watch(descriptor) - inotify.close() - if os.path.isfile(test_file): - os.unlink(test_file) - - def _consume_wait_unmodified(file, num_tries=20, wait_time=1): mtime = -1 current_try = 0 @@ -179,24 +154,16 @@ class Command(BaseCommand): return if settings.CONSUMER_POLLING == 0: - if _test_inotify(directory): - self.handle_inotify(directory, recursive) - else: - logger.warning( - f"Inotify notifications are not available on {directory}, " - f"falling back to polling every 10 seconds") - self.handle_polling( - directory, recursive, 10) + self.handle_inotify(directory, recursive) else: - self.handle_polling( - directory, recursive, settings.CONSUMER_POLLING) + self.handle_polling(directory, recursive) logger.debug("Consumer exiting.") - def handle_polling(self, directory, recursive, timeout): + def handle_polling(self, directory, recursive): logging.getLogger(__name__).info( f"Polling directory for changes: {directory}") - self.observer = PollingObserver(timeout=timeout) + self.observer = PollingObserver(timeout=settings.CONSUMER_POLLING) self.observer.schedule(Handler(), directory, recursive=recursive) self.observer.start() try: diff --git a/src/documents/tests/test_management_consumer.py b/src/documents/tests/test_management_consumer.py index 0680e7f56..b6a61a167 100644 --- a/src/documents/tests/test_management_consumer.py +++ b/src/documents/tests/test_management_consumer.py @@ -7,9 +7,8 @@ from unittest import mock from django.conf import settings from django.core.management import call_command, CommandError -from django.test import override_settings, TransactionTestCase, TestCase +from django.test import override_settings, TransactionTestCase -from documents.management.commands.document_consumer import _test_inotify from documents.models import Tag from documents.consumer import ConsumerError from documents.management.commands import document_consumer @@ -261,27 +260,3 @@ class TestConsumerTags(DirectoriesMixin, ConsumerMixin, TransactionTestCase): @override_settings(CONSUMER_POLLING=1) def test_consume_file_with_path_tags_polling(self): self.test_consume_file_with_path_tags() - - -class TestInotify(DirectoriesMixin, TestCase): - - def test_inotify(self): - self.assertTrue(_test_inotify(self.dirs.consumption_dir)) - - @mock.patch("documents.management.commands.document_consumer.Path.touch") - def test_inotify_error(self, m): - m.side_effect = OSError("Permission error") - self.assertFalse(_test_inotify(self.dirs.consumption_dir)) - - @mock.patch("documents.management.commands.document_consumer.Command.handle_polling") - @mock.patch("documents.management.commands.document_consumer.Command.handle_inotify") - @mock.patch("documents.management.commands.document_consumer._test_inotify") - def test_polling_fallback(self, test_inotify, handle_inotify, handle_polling): - test_inotify.return_value = False - - cmd = document_consumer.Command() - cmd.handle(directory=settings.CONSUMPTION_DIR, oneshot=False) - - test_inotify.assert_called_once() - handle_polling.assert_called_once() - handle_inotify.assert_not_called() From 9f1436a865621d313de7c6fd4eccd3957eb7b7ea Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Wed, 20 Jan 2021 12:34:01 +0100 Subject: [PATCH 04/19] more test --- src/documents/tests/test_api.py | 47 +++++++++++++++++++++++++++++ src/documents/tests/test_parsers.py | 1 + 2 files changed, 48 insertions(+) diff --git a/src/documents/tests/test_api.py b/src/documents/tests/test_api.py index 5f81b83b6..6b9cf14e0 100644 --- a/src/documents/tests/test_api.py +++ b/src/documents/tests/test_api.py @@ -923,6 +923,14 @@ class TestBulkEdit(DirectoriesMixin, APITestCase): doc2 = Document.objects.get(id=self.doc2.id) self.assertEqual(doc2.correspondent, self.c1) + def test_api_no_correspondent(self): + response = self.client.post("/api/documents/bulk_edit/", json.dumps({ + "documents": [self.doc2.id], + "method": "set_correspondent", + "parameters": {} + }), content_type='application/json') + self.assertEqual(response.status_code, 400) + def test_api_invalid_document_type(self): self.assertEqual(self.doc2.document_type, self.dt1) response = self.client.post("/api/documents/bulk_edit/", json.dumps({ @@ -935,6 +943,14 @@ class TestBulkEdit(DirectoriesMixin, APITestCase): doc2 = Document.objects.get(id=self.doc2.id) self.assertEqual(doc2.document_type, self.dt1) + def test_api_no_document_type(self): + response = self.client.post("/api/documents/bulk_edit/", json.dumps({ + "documents": [self.doc2.id], + "method": "set_document_type", + "parameters": {} + }), content_type='application/json') + self.assertEqual(response.status_code, 400) + def test_api_add_invalid_tag(self): self.assertEqual(list(self.doc2.tags.all()), [self.t1]) response = self.client.post("/api/documents/bulk_edit/", json.dumps({ @@ -946,6 +962,14 @@ class TestBulkEdit(DirectoriesMixin, APITestCase): self.assertEqual(list(self.doc2.tags.all()), [self.t1]) + def test_api_add_tag_no_tag(self): + response = self.client.post("/api/documents/bulk_edit/", json.dumps({ + "documents": [self.doc2.id], + "method": "add_tag", + "parameters": {} + }), content_type='application/json') + self.assertEqual(response.status_code, 400) + def test_api_delete_invalid_tag(self): self.assertEqual(list(self.doc2.tags.all()), [self.t1]) response = self.client.post("/api/documents/bulk_edit/", json.dumps({ @@ -957,6 +981,14 @@ class TestBulkEdit(DirectoriesMixin, APITestCase): self.assertEqual(list(self.doc2.tags.all()), [self.t1]) + def test_api_delete_tag_no_tag(self): + response = self.client.post("/api/documents/bulk_edit/", json.dumps({ + "documents": [self.doc2.id], + "method": "remove_tag", + "parameters": {} + }), content_type='application/json') + self.assertEqual(response.status_code, 400) + def test_api_modify_invalid_tags(self): self.assertEqual(list(self.doc2.tags.all()), [self.t1]) response = self.client.post("/api/documents/bulk_edit/", json.dumps({ @@ -966,6 +998,21 @@ class TestBulkEdit(DirectoriesMixin, APITestCase): }), content_type='application/json') self.assertEqual(response.status_code, 400) + def test_api_modify_tags_no_tags(self): + response = self.client.post("/api/documents/bulk_edit/", json.dumps({ + "documents": [self.doc2.id], + "method": "modify_tags", + "parameters": {"remove_tags": [1123123]} + }), content_type='application/json') + self.assertEqual(response.status_code, 400) + + response = self.client.post("/api/documents/bulk_edit/", json.dumps({ + "documents": [self.doc2.id], + "method": "modify_tags", + "parameters": {'add_tags': [self.t2.id, 1657]} + }), content_type='application/json') + self.assertEqual(response.status_code, 400) + def test_api_selection_data_empty(self): response = self.client.post("/api/documents/selection_data/", json.dumps({ "documents": [] diff --git a/src/documents/tests/test_parsers.py b/src/documents/tests/test_parsers.py index 805e4beac..392c0504f 100644 --- a/src/documents/tests/test_parsers.py +++ b/src/documents/tests/test_parsers.py @@ -120,3 +120,4 @@ class TestParserAvailability(TestCase): self.assertTrue(is_file_ext_supported('.pdf')) self.assertFalse(is_file_ext_supported('.hsdfh')) + self.assertFalse(is_file_ext_supported('')) From f6a2cc74e84847fbd01b0d16e3ed6b3eee76ee85 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Wed, 20 Jan 2021 14:25:52 +0100 Subject: [PATCH 05/19] clicking on small and large cards changed --- .../document-card-large/document-card-large.component.html | 4 ++-- .../document-card-small/document-card-small.component.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html index 85964f528..d26c17159 100644 --- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html +++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html @@ -1,6 +1,6 @@ -
+
-
+
diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html index a0d0299a5..882de71ed 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html @@ -1,6 +1,6 @@
-
-
+
+
From 43685baff32b1e5c6cee764bd0f95764917cddf6 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Wed, 20 Jan 2021 14:29:30 +0100 Subject: [PATCH 06/19] fix tag clicking on document table list --- .../app/components/document-list/document-list.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-ui/src/app/components/document-list/document-list.component.html b/src-ui/src/app/components/document-list/document-list.component.html index a29e146bf..cfc2e655d 100644 --- a/src-ui/src/app/components/document-list/document-list.component.html +++ b/src-ui/src/app/components/document-list/document-list.component.html @@ -152,7 +152,7 @@ {{d.title | documentTitle}} - + From 482ef6313da570e6bbe84b4253200efff0377f33 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Wed, 20 Jan 2021 14:35:38 +0100 Subject: [PATCH 07/19] changelog --- docs/changelog.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 721e9520e..28bcc00e6 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,7 +5,6 @@ Changelog ********* - paperless-ng 1.0.0 ################## @@ -25,7 +24,8 @@ Nothing special about this release, but since there are relatively few bug repor * Added a language selector to the settings. * Added date format options to the settings. * Range selection with shift clicking is now possible in the document list. - + * Filtering correspondent, type and tag management pages by name. + * Focus "Name" field in dialogs by default. paperless-ng 0.9.14 From 03e159f67c623d8fc79f4a8c9ca01640a250b4a6 Mon Sep 17 00:00:00 2001 From: "transifex-integration[bot]" <43880903+transifex-integration[bot]@users.noreply.github.com> Date: Wed, 20 Jan 2021 13:44:24 +0000 Subject: [PATCH 08/19] Translate /src-ui/messages.xlf in nl_NL at least 99% translated for the source file '/src-ui/messages.xlf' on the 'nl_NL' language. Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format --- src-ui/src/locale/messages.nl_NL.xlf | 42 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src-ui/src/locale/messages.nl_NL.xlf b/src-ui/src/locale/messages.nl_NL.xlf index 39545c0e2..49f3010ad 100644 --- a/src-ui/src/locale/messages.nl_NL.xlf +++ b/src-ui/src/locale/messages.nl_NL.xlf @@ -449,12 +449,20 @@ 2 + + Filter by: + Filter op: + + src/app/components/manage/tag-list/tag-list.component.html + 8 + + Name Naam src/app/components/manage/tag-list/tag-list.component.html - 13 + 9 @@ -462,7 +470,7 @@ Kleur src/app/components/manage/tag-list/tag-list.component.html - 14 + 20 @@ -470,7 +478,7 @@ Overeenkomend src/app/components/manage/tag-list/tag-list.component.html - 15 + 21 @@ -478,7 +486,7 @@ Aantal documenten src/app/components/manage/tag-list/tag-list.component.html - 16 + 22 @@ -486,7 +494,7 @@ Acties src/app/components/manage/tag-list/tag-list.component.html - 17 + 23 @@ -494,7 +502,7 @@ Documenten src/app/components/manage/tag-list/tag-list.component.html - 32 + 38 @@ -502,7 +510,7 @@ Bewerk src/app/components/manage/tag-list/tag-list.component.html - 37 + 43 @@ -814,7 +822,7 @@ Laatste correspondentie src/app/components/manage/correspondent-list/correspondent-list.component.html - 15 + 22 @@ -1114,14 +1122,6 @@ 46 - - Filter by: - Filter op: - - src/app/components/document-list/filter-editor/filter-editor.component.html - 4 - - Filter tags Etiketten filteren @@ -1907,7 +1907,7 @@ Automatisch src/app/components/manage/generic-list/generic-list.component.ts - 33 + 39 @@ -1915,7 +1915,7 @@ Wil je dit element echt verwijderen? src/app/components/manage/generic-list/generic-list.component.ts - 76 + 97 @@ -1923,7 +1923,7 @@ Geassocieerde documenten zullen niet verwijderd worden. src/app/components/manage/generic-list/generic-list.component.ts - 83 + 104 @@ -1931,7 +1931,7 @@ Verwijderen src/app/components/manage/generic-list/generic-list.component.ts - 85 + 106 @@ -1939,7 +1939,7 @@ Fout bij het verwijderen van het element: src/app/components/manage/generic-list/generic-list.component.ts - 93 + 114 From 54916fec2ed1b963cbe2cc177a96faca4c588c4b Mon Sep 17 00:00:00 2001 From: "transifex-integration[bot]" <43880903+transifex-integration[bot]@users.noreply.github.com> Date: Wed, 20 Jan 2021 13:44:31 +0000 Subject: [PATCH 09/19] Translate /src-ui/messages.xlf in fr at least 99% translated for the source file '/src-ui/messages.xlf' on the 'fr' language. Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format --- src-ui/src/locale/messages.fr.xlf | 42 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src-ui/src/locale/messages.fr.xlf b/src-ui/src/locale/messages.fr.xlf index ee97f7ce0..0ee824d5b 100644 --- a/src-ui/src/locale/messages.fr.xlf +++ b/src-ui/src/locale/messages.fr.xlf @@ -449,12 +449,20 @@ 2 + + Filter by: + Filtrer par : + + src/app/components/manage/tag-list/tag-list.component.html + 8 + + Name Nom src/app/components/manage/tag-list/tag-list.component.html - 13 + 9 @@ -462,7 +470,7 @@ Couleur src/app/components/manage/tag-list/tag-list.component.html - 14 + 20 @@ -470,7 +478,7 @@ Rapprochement src/app/components/manage/tag-list/tag-list.component.html - 15 + 21 @@ -478,7 +486,7 @@ Nombre de documents src/app/components/manage/tag-list/tag-list.component.html - 16 + 22 @@ -486,7 +494,7 @@ Actions src/app/components/manage/tag-list/tag-list.component.html - 17 + 23 @@ -494,7 +502,7 @@ Documents src/app/components/manage/tag-list/tag-list.component.html - 32 + 38 @@ -502,7 +510,7 @@ Éditer src/app/components/manage/tag-list/tag-list.component.html - 37 + 43 @@ -814,7 +822,7 @@ Dernière correspondance src/app/components/manage/correspondent-list/correspondent-list.component.html - 15 + 22 @@ -1114,14 +1122,6 @@ 46 - - Filter by: - Filtrer par : - - src/app/components/document-list/filter-editor/filter-editor.component.html - 4 - - Filter tags Filtrer les étiquettes @@ -1907,7 +1907,7 @@ Automatique src/app/components/manage/generic-list/generic-list.component.ts - 33 + 39 @@ -1915,7 +1915,7 @@ Voulez-vous vraiment supprimer cet élément ? src/app/components/manage/generic-list/generic-list.component.ts - 76 + 97 @@ -1923,7 +1923,7 @@ Les documents associés ne seront pas supprimés. src/app/components/manage/generic-list/generic-list.component.ts - 83 + 104 @@ -1931,7 +1931,7 @@ Supprimer src/app/components/manage/generic-list/generic-list.component.ts - 85 + 106 @@ -1939,7 +1939,7 @@ Une erreur s'est produite lors de la suppression de l'élément : src/app/components/manage/generic-list/generic-list.component.ts - 93 + 114 From 937cdaccadc303eff159086bd86c8fcf831162b0 Mon Sep 17 00:00:00 2001 From: "transifex-integration[bot]" <43880903+transifex-integration[bot]@users.noreply.github.com> Date: Wed, 20 Jan 2021 13:44:37 +0000 Subject: [PATCH 10/19] Translate /src-ui/messages.xlf in de at least 99% translated for the source file '/src-ui/messages.xlf' on the 'de' language. Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format --- src-ui/src/locale/messages.de.xlf | 42 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src-ui/src/locale/messages.de.xlf b/src-ui/src/locale/messages.de.xlf index 80cfefab9..e1539618c 100644 --- a/src-ui/src/locale/messages.de.xlf +++ b/src-ui/src/locale/messages.de.xlf @@ -449,12 +449,20 @@ 2 + + Filter by: + Filtern nach: + + src/app/components/manage/tag-list/tag-list.component.html + 8 + + Name Name src/app/components/manage/tag-list/tag-list.component.html - 13 + 9 @@ -462,7 +470,7 @@ Farbe src/app/components/manage/tag-list/tag-list.component.html - 14 + 20 @@ -470,7 +478,7 @@ Zuweisung src/app/components/manage/tag-list/tag-list.component.html - 15 + 21 @@ -478,7 +486,7 @@ Anzahl Dokumente src/app/components/manage/tag-list/tag-list.component.html - 16 + 22 @@ -486,7 +494,7 @@ Aktionen src/app/components/manage/tag-list/tag-list.component.html - 17 + 23 @@ -494,7 +502,7 @@ Dokumente src/app/components/manage/tag-list/tag-list.component.html - 32 + 38 @@ -502,7 +510,7 @@ Bearbeiten src/app/components/manage/tag-list/tag-list.component.html - 37 + 43 @@ -814,7 +822,7 @@ Letzter Kontakt src/app/components/manage/correspondent-list/correspondent-list.component.html - 15 + 22 @@ -1114,14 +1122,6 @@ 46 - - Filter by: - Filtern nach: - - src/app/components/document-list/filter-editor/filter-editor.component.html - 4 - - Filter tags Tags filtern @@ -1907,7 +1907,7 @@ Automatisch src/app/components/manage/generic-list/generic-list.component.ts - 33 + 39 @@ -1915,7 +1915,7 @@ Möchten Sie dieses Element wirklich löschen? src/app/components/manage/generic-list/generic-list.component.ts - 76 + 97 @@ -1923,7 +1923,7 @@ Assoziierte Dokumente werden nicht gelöscht. src/app/components/manage/generic-list/generic-list.component.ts - 83 + 104 @@ -1931,7 +1931,7 @@ Löschen src/app/components/manage/generic-list/generic-list.component.ts - 85 + 106 @@ -1939,7 +1939,7 @@ Fehler beim Löschen des Elements: src/app/components/manage/generic-list/generic-list.component.ts - 93 + 114 From 9575b0fe3210faff9b41ca52d8081ebbc3b9fcba Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Wed, 20 Jan 2021 20:28:42 +0100 Subject: [PATCH 11/19] fixes #397 --- src/documents/models.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/documents/models.py b/src/documents/models.py index 928b8aa4d..86878dd7e 100755 --- a/src/documents/models.py +++ b/src/documents/models.py @@ -63,12 +63,6 @@ class MatchingModel(models.Model): def __str__(self): return self.name - def save(self, *args, **kwargs): - - self.match = self.match.lower() - - models.Model.save(self, *args, **kwargs) - class Correspondent(MatchingModel): From ddf386c4d4aa61f59c671a54be07e5880ec95276 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Thu, 21 Jan 2021 01:02:41 +0100 Subject: [PATCH 12/19] add temporary directory during startup and ensure correct permissions --- docker/docker-entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 8e1a21757..5919b14aa 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -79,7 +79,11 @@ initialize() { fi done + echo "creating directory /tmp/paperless" + mkdir -p /tmp/paperless + chown -R paperless:paperless ../ + chown -R paperless:paperless /tmp/paperless migrations From aeb10d34079bb62d5d748698062de0bfa9a20585 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Thu, 21 Jan 2021 12:07:50 +0100 Subject: [PATCH 13/19] fixes duplicate documents with tags__id__in --- src/documents/tests/test_api.py | 6 ++++++ src/documents/views.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/documents/tests/test_api.py b/src/documents/tests/test_api.py index 6b9cf14e0..2b332a873 100644 --- a/src/documents/tests/test_api.py +++ b/src/documents/tests/test_api.py @@ -228,6 +228,12 @@ class TestDocumentApi(DirectoriesMixin, APITestCase): self.assertEqual(len(results), 2) self.assertCountEqual([results[0]['id'], results[1]['id']], [doc1.id, doc3.id]) + response = self.client.get("/api/documents/?tags__id__in={},{}".format(tag_2.id, tag_3.id)) + self.assertEqual(response.status_code, 200) + results = response.data['results'] + self.assertEqual(len(results), 2) + self.assertCountEqual([results[0]['id'], results[1]['id']], [doc2.id, doc3.id]) + response = self.client.get("/api/documents/?tags__id__all={},{}".format(tag_2.id, tag_3.id)) self.assertEqual(response.status_code, 200) results = response.data['results'] diff --git a/src/documents/views.py b/src/documents/views.py index eb9078f75..b99bf11c7 100755 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -159,6 +159,9 @@ class DocumentViewSet(RetrieveModelMixin, "added", "archive_serial_number") + def get_queryset(self): + return Document.objects.distinct() + def get_serializer(self, *args, **kwargs): fields_param = self.request.query_params.get('fields', None) if fields_param: From 11f9616411612e501755b314bd73a3263fb99151 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Thu, 21 Jan 2021 21:05:16 +0100 Subject: [PATCH 14/19] improve locale selection options --- src-ui/messages.xlf | 14 +++++++------- .../manage/settings/settings.component.html | 4 ++-- .../manage/settings/settings.component.ts | 5 +++-- src-ui/src/app/services/settings.service.ts | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf index 1e89a9408..6175cf700 100644 --- a/src-ui/messages.xlf +++ b/src-ui/messages.xlf @@ -482,35 +482,35 @@ Saved view "" deleted. src/app/components/manage/settings/settings.component.ts - 62 + 63 Settings saved successfully. src/app/components/manage/settings/settings.component.ts - 78 + 79 Use system language src/app/components/manage/settings/settings.component.ts - 82 + 83 Use date format of display language src/app/components/manage/settings/settings.component.ts - 86 + 87 Error while storing settings on server: src/app/components/manage/settings/settings.component.ts - 102 + 103 @@ -1463,8 +1463,8 @@ 12 - - English + + English (US) src/app/services/settings.service.ts 74 diff --git a/src-ui/src/app/components/manage/settings/settings.component.html b/src-ui/src/app/components/manage/settings/settings.component.html index 13ffb4517..4ed5ad1ae 100644 --- a/src-ui/src/app/components/manage/settings/settings.component.html +++ b/src-ui/src/app/components/manage/settings/settings.component.html @@ -19,7 +19,7 @@
You need to reload the page after applying a new language. @@ -34,7 +34,7 @@
diff --git a/src-ui/src/app/components/manage/settings/settings.component.ts b/src-ui/src/app/components/manage/settings/settings.component.ts index 3c4de59b6..47f714c21 100644 --- a/src-ui/src/app/components/manage/settings/settings.component.ts +++ b/src-ui/src/app/components/manage/settings/settings.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Renderer2 } from '@angular/core'; +import { Component, Inject, LOCALE_ID, OnInit, Renderer2 } from '@angular/core'; import { FormControl, FormGroup } from '@angular/forms'; import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'; import { DocumentListViewService } from 'src/app/services/document-list-view.service'; @@ -38,7 +38,8 @@ export class SettingsComponent implements OnInit { public savedViewService: SavedViewService, private documentListViewService: DocumentListViewService, private toastService: ToastService, - private settings: SettingsService + private settings: SettingsService, + @Inject(LOCALE_ID) public currentLocale: string ) { } ngOnInit() { diff --git a/src-ui/src/app/services/settings.service.ts b/src-ui/src/app/services/settings.service.ts index d2a190c1f..041fb51ca 100644 --- a/src-ui/src/app/services/settings.service.ts +++ b/src-ui/src/app/services/settings.service.ts @@ -71,7 +71,7 @@ export class SettingsService { getLanguageOptions(): LanguageOption[] { return [ - {code: "en-us", name: $localize`English`, englishName: "English"}, + {code: "en-US", name: $localize`English (US)`, englishName: "English (US)"}, {code: "de", name: $localize`German`, englishName: "German"}, {code: "nl", name: $localize`Dutch`, englishName: "Dutch"}, {code: "fr", name: $localize`French`, englishName: "French"} From 3b22d7131dfd924909da3be7f8a0713f54b60a92 Mon Sep 17 00:00:00 2001 From: "transifex-integration[bot]" <43880903+transifex-integration[bot]@users.noreply.github.com> Date: Thu, 21 Jan 2021 20:08:36 +0000 Subject: [PATCH 15/19] Translate /src-ui/messages.xlf in nl_NL translation completed for the source file '/src-ui/messages.xlf' on the 'nl_NL' language. --- src-ui/src/locale/messages.nl_NL.xlf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src-ui/src/locale/messages.nl_NL.xlf b/src-ui/src/locale/messages.nl_NL.xlf index 49f3010ad..3753bc92c 100644 --- a/src-ui/src/locale/messages.nl_NL.xlf +++ b/src-ui/src/locale/messages.nl_NL.xlf @@ -550,7 +550,7 @@ Opgeslagen view "" verwijderd. src/app/components/manage/settings/settings.component.ts - 62 + 63 @@ -558,7 +558,7 @@ Instellingen succesvol opgeslagen. src/app/components/manage/settings/settings.component.ts - 78 + 79 @@ -566,7 +566,7 @@ Gebruik de systeemtaal src/app/components/manage/settings/settings.component.ts - 82 + 83 @@ -574,7 +574,7 @@ Datumopmaak van weergavetaal gebruiken src/app/components/manage/settings/settings.component.ts - 86 + 87 @@ -582,7 +582,7 @@ Fout bij het opslaan van de instellingen: src/app/components/manage/settings/settings.component.ts - 102 + 103 @@ -1670,9 +1670,9 @@ 12 - - English - Engels + + English (US) + Engels (US) src/app/services/settings.service.ts 74 From 099b84a66dd19a8dd44e2eea613c6b040b871bba Mon Sep 17 00:00:00 2001 From: "transifex-integration[bot]" <43880903+transifex-integration[bot]@users.noreply.github.com> Date: Thu, 21 Jan 2021 20:08:46 +0000 Subject: [PATCH 16/19] Translate /src-ui/messages.xlf in fr translation completed for the source file '/src-ui/messages.xlf' on the 'fr' language. --- src-ui/src/locale/messages.fr.xlf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src-ui/src/locale/messages.fr.xlf b/src-ui/src/locale/messages.fr.xlf index 0ee824d5b..4f09eab72 100644 --- a/src-ui/src/locale/messages.fr.xlf +++ b/src-ui/src/locale/messages.fr.xlf @@ -550,7 +550,7 @@ Vue "" supprimée. src/app/components/manage/settings/settings.component.ts - 62 + 63 @@ -558,7 +558,7 @@ Paramètres enregistrés avec succès. src/app/components/manage/settings/settings.component.ts - 78 + 79 @@ -566,7 +566,7 @@ Utiliser la langue du système src/app/components/manage/settings/settings.component.ts - 82 + 83 @@ -574,7 +574,7 @@ Utiliser le format de date de la langue d'affichage src/app/components/manage/settings/settings.component.ts - 86 + 87 @@ -582,7 +582,7 @@ Une erreur s'est produite lors de l'enregistrement des paramètres sur le serveur : src/app/components/manage/settings/settings.component.ts - 102 + 103 @@ -1670,9 +1670,9 @@ 12 - - English - Anglais + + English (US) + Anglais (US) src/app/services/settings.service.ts 74 From 18ebb58dc90cdfb1ddb665ae5cc30918b550efbe Mon Sep 17 00:00:00 2001 From: "transifex-integration[bot]" <43880903+transifex-integration[bot]@users.noreply.github.com> Date: Thu, 21 Jan 2021 20:08:58 +0000 Subject: [PATCH 17/19] Translate /src-ui/messages.xlf in de translation completed for the source file '/src-ui/messages.xlf' on the 'de' language. --- src-ui/src/locale/messages.de.xlf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src-ui/src/locale/messages.de.xlf b/src-ui/src/locale/messages.de.xlf index e1539618c..a898e4630 100644 --- a/src-ui/src/locale/messages.de.xlf +++ b/src-ui/src/locale/messages.de.xlf @@ -550,7 +550,7 @@ Gespeicherte Ansicht "" gelöscht. src/app/components/manage/settings/settings.component.ts - 62 + 63 @@ -558,7 +558,7 @@ Einstellungen erfolgreich gespeichert. src/app/components/manage/settings/settings.component.ts - 78 + 79 @@ -566,7 +566,7 @@ Benutze Systemsprache src/app/components/manage/settings/settings.component.ts - 82 + 83 @@ -574,7 +574,7 @@ Benutze Datumsformat der Anzeigesprache src/app/components/manage/settings/settings.component.ts - 86 + 87 @@ -582,7 +582,7 @@ Fehler beim Speichern der Einstellungen auf dem Server: src/app/components/manage/settings/settings.component.ts - 102 + 103 @@ -1670,9 +1670,9 @@ 12 - - English - Englisch + + English (US) + Englisch (US) src/app/services/settings.service.ts 74 From 87ad2ce1d68be2068992461077721ccea8b90866 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Thu, 21 Jan 2021 21:32:08 +0100 Subject: [PATCH 18/19] added a note regarding updates after 0.9.13 --- docs/administration.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/administration.rst b/docs/administration.rst index bb543e3db..14b986e82 100644 --- a/docs/administration.rst +++ b/docs/administration.rst @@ -90,10 +90,28 @@ B. If you built the image yourself, do the following: $ docker-compose build $ docker-compose up -Running `docker-compose up` will also apply any new database migrations. +Running ``docker-compose up`` will also apply any new database migrations. If you see everything working, press CTRL+C once to gracefully stop paperless. Then you can start paperless-ng with ``-d`` to have it run in the background. + .. note:: + + In version 0.9.14, the update process was changed. In 0.9.13 and earlier, the + docker-compose files specified exact versions and pull won't automatically + update to newer versions. In order to enable updates as described above, either + get the new ``docker-compose.yml`` file from `here `_ + or edit the ``docker-compose.yml`` file, find the line that says + + .. code:: + + image: jonaswinkler/paperless-ng:0.9.x + + and replace the version with ``latest``: + + .. code:: + + image: jonaswinkler/paperless-ng:latest + Bare Metal Route ================ From 227f7b6946c119fd3b69f9313ea49c08f3d22310 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Thu, 21 Jan 2021 22:29:47 +0100 Subject: [PATCH 19/19] revert a change --- src/documents/management/commands/document_consumer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/documents/management/commands/document_consumer.py b/src/documents/management/commands/document_consumer.py index 690f5299a..9ba1b1a87 100644 --- a/src/documents/management/commands/document_consumer.py +++ b/src/documents/management/commands/document_consumer.py @@ -153,7 +153,7 @@ class Command(BaseCommand): if options["oneshot"]: return - if settings.CONSUMER_POLLING == 0: + if settings.CONSUMER_POLLING == 0 and INotify: self.handle_inotify(directory, recursive) else: self.handle_polling(directory, recursive)