]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Merge branch 'dev' into feature-permissions
authorshamoon <4887959+shamoon@users.noreply.github.com>
Fri, 3 Feb 2023 22:23:50 +0000 (14:23 -0800)
committershamoon <4887959+shamoon@users.noreply.github.com>
Fri, 3 Feb 2023 22:23:50 +0000 (14:23 -0800)
1  2 
src-ui/src/app/components/document-detail/document-detail.component.ts
src/documents/consumer.py
src/documents/index.py
src/documents/models.py
src/documents/tasks.py
src/documents/tests/test_api.py

Simple merge
index 5adbcc5b6913b965d95419266a2c4d56a8c522f2,e11708f459a9206877862ea8a874f7578866a2cb..c0b3f5465998e314ad7e2a6543c6ad960a23161d
@@@ -5,9 -5,9 +5,10 @@@ from contextlib import contextmanage
  
  from dateutil.parser import isoparse
  from django.conf import settings
+ from django.utils import timezone
  from documents.models import Comment
  from documents.models import Document
 +from guardian.shortcuts import get_users_with_perms
  from whoosh import classify
  from whoosh import highlight
  from whoosh import query
@@@ -98,11 -94,18 +99,23 @@@ def update_document(writer: AsyncWriter
      tags = ",".join([t.name for t in doc.tags.all()])
      tags_ids = ",".join([str(t.id) for t in doc.tags.all()])
      comments = ",".join([str(c.comment) for c in Comment.objects.filter(document=doc)])
+     asn = doc.archive_serial_number
+     if asn is not None and (
+         asn < Document.ARCHIVE_SERIAL_NUMBER_MIN
+         or asn > Document.ARCHIVE_SERIAL_NUMBER_MAX
+     ):
+         logger.error(
+             f"Not indexing Archive Serial Number {asn} of document {doc.pk}. "
+             f"ASN is out of range "
+             f"[{Document.ARCHIVE_SERIAL_NUMBER_MIN:,}, "
+             f"{Document.ARCHIVE_SERIAL_NUMBER_MAX:,}.",
+         )
+         asn = 0
 +    users_with_perms = get_users_with_perms(
 +        doc,
 +        only_with_perms_in=["view_document"],
 +    )
 +    viewer_ids = ",".join([str(u.id) for u in users_with_perms])
      writer.update_document(
          id=doc.pk,
          title=doc.title,
Simple merge
Simple merge
Simple merge