Compare commits

..
3 changed files with 13 additions and 50 deletions
@@ -11,7 +11,6 @@ from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import FieldError
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase as DjangoTestCase
from django.utils import timezone
from rest_framework import status
from rest_framework.test import APITestCase
@@ -22,7 +21,6 @@ from documents.filters import TitleContentFilter
from documents.models import Document
from documents.tests.utils import DirectoriesMixin
from documents.tests.utils import read_streaming_response
from documents.views import DocumentSelectionMixin
if TYPE_CHECKING:
from pathlib import Path
@@ -925,36 +923,3 @@ class TestVersionAwareFilters(TestCase):
self.assertIs(result, queryset)
queryset.filter.assert_not_called()
class TestBulkSelectionExcludesVersions(DjangoTestCase):
def test_select_all_matching_does_not_select_version_documents(self) -> None:
"""
"Select all matching" reconstructs the document list, which never
contains version documents as rows of their own.
"""
user = User.objects.create_superuser(username="bulk_versions")
root = Document.objects.create(
title="shared-title root",
checksum="bulk-root",
mime_type="application/pdf",
content="root",
)
Document.objects.create(
title="shared-title version",
checksum="bulk-version",
mime_type="application/pdf",
root_document=root,
version_index=1,
content="version",
)
selected = DocumentSelectionMixin()._resolve_document_ids(
user=user,
validated_data={
"all": True,
"filters": {"title__icontains": "shared-title"},
},
)
self.assertEqual(selected, [root.id])
+2 -4
View File
@@ -1133,7 +1133,8 @@ class DocumentViewSet(
"custom_fields",
queryset=CustomFieldInstance.objects.select_related("field"),
),
"notes",
# NotesSerializer nests the author, this avoids query per note
Prefetch("notes", queryset=Note.objects.select_related("user")),
)
)
@@ -2794,11 +2795,8 @@ class DocumentSelectionMixin:
for key, value in filters.items()
if key not in _TANTIVY_SEARCH_PARAM_NAMES
}
# Operations are addressed to roots, a caller that wants
# to act on a specific version passes its id explicitly instead
permitted_documents = Document.objects.filter(
id__in=permitted_document_ids(user),
root_document__isnull=True,
)
# orm-filtered docs
filtered_documents = DocumentFilterSet(
+11 -11
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: paperless-ngx\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-08-24 21:43+0000\n"
"POT-Creation-Date: 2026-08-25 21:36+0000\n"
"PO-Revision-Date: 2022-02-17 04:17\n"
"Last-Translator: \n"
"Language-Team: English\n"
@@ -1580,7 +1580,7 @@ msgid "workflow runs"
msgstr ""
#: documents/serialisers.py:523 documents/serialisers.py:875
#: documents/serialisers.py:2827 documents/views.py:311 documents/views.py:2612
#: documents/serialisers.py:2827 documents/views.py:311 documents/views.py:2613
#: paperless_mail/serialisers.py:155
msgid "Insufficient permissions."
msgstr ""
@@ -1621,7 +1621,7 @@ msgstr ""
msgid "Duplicate document identifiers are not allowed."
msgstr ""
#: documents/serialisers.py:2913 documents/views.py:4606
#: documents/serialisers.py:2913 documents/views.py:4607
#, python-format
msgid "Documents not found: %(ids)s"
msgstr ""
@@ -1889,36 +1889,36 @@ msgstr ""
msgid "Unable to parse URI {value}"
msgstr ""
#: documents/views.py:304 documents/views.py:2609
#: documents/views.py:304 documents/views.py:2610
msgid "Invalid more_like_id"
msgstr ""
#: documents/views.py:1586
#: documents/views.py:1587
msgid "Invalid AI configuration."
msgstr ""
#: documents/views.py:1597
#: documents/views.py:1598
msgid "AI backend request timed out."
msgstr ""
#: documents/views.py:2434 documents/views.py:2755
#: documents/views.py:2435 documents/views.py:2756
msgid "Specify only one of text, title_search, query, or more_like_id."
msgstr ""
#: documents/views.py:4619
#: documents/views.py:4620
#, python-format
msgid "Insufficient permissions to share document %(id)s."
msgstr ""
#: documents/views.py:4665
#: documents/views.py:4666
msgid "Bundle is already being processed."
msgstr ""
#: documents/views.py:4726
#: documents/views.py:4727
msgid "The share link bundle is still being prepared. Please try again later."
msgstr ""
#: documents/views.py:4736
#: documents/views.py:4737
msgid "The share link bundle is unavailable."
msgstr ""