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:
stumpylog
2026-07-27 20:14:26 -07:00
co-authored by Claude Haiku
parent 4352a8be0f
commit 137a86bcb1
+1 -3
View File
@@ -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):