mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-07-30 15:45:58 +00:00
refactor: remove redundant deleted_at filter in permitted_document_ids
Document.objects already applies filter(deleted_at__isnull=True) internally via SoftDeleteManager.get_queryset(), so the conditional filter was redundant. Simplify to just use manager.all() in both branches — manager selection alone ensures correct behavior (Document.objects excludes deleted, Document.global_objects includes all). Co-Authored-By: Claude Haiku <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session
This commit is contained in:
co-authored by
Claude Haiku
parent
4352a8be0f
commit
137a86bcb1
@@ -173,9 +173,7 @@ def permitted_document_ids(user, *, include_deleted: bool = False):
|
||||
"""
|
||||
|
||||
manager = Document.global_objects if include_deleted else Document.objects
|
||||
base_docs = (
|
||||
manager.all() if include_deleted else manager.filter(deleted_at__isnull=True)
|
||||
)
|
||||
base_docs = manager.all()
|
||||
base_docs = base_docs.only("id", "owner")
|
||||
|
||||
if user is None or not getattr(user, "is_authenticated", False):
|
||||
|
||||
Reference in New Issue
Block a user