Just accept document_ids, I dont even remember why I did this

This commit is contained in:
shamoon
2026-01-26 11:55:52 -08:00
parent 0f242c2d3a
commit 9db89bac3e

View File

@@ -2290,7 +2290,6 @@ class ShareLinkBundleSerializer(OwnedObjectSerializer):
def create(self, validated_data): def create(self, validated_data):
document_ids = validated_data.pop("document_ids") document_ids = validated_data.pop("document_ids")
expiration_days = validated_data.pop("expiration_days", None) expiration_days = validated_data.pop("expiration_days", None)
documents = validated_data.pop("documents", None)
validated_data["slug"] = get_random_string(50) validated_data["slug"] = get_random_string(50)
if expiration_days: if expiration_days:
validated_data["expiration"] = timezone.now() + timedelta( validated_data["expiration"] = timezone.now() + timedelta(
@@ -2301,15 +2300,11 @@ class ShareLinkBundleSerializer(OwnedObjectSerializer):
share_link_bundle = super().create(validated_data) share_link_bundle = super().create(validated_data)
if documents is None:
documents = list( documents = list(
Document.objects.filter(pk__in=document_ids).only( Document.objects.filter(pk__in=document_ids).only(
"pk", "pk",
), ),
) )
else:
documents = list(documents)
documents_by_id = {doc.pk: doc for doc in documents} documents_by_id = {doc.pk: doc for doc in documents}
missing = [ missing = [
str(doc_id) for doc_id in document_ids if doc_id not in documents_by_id str(doc_id) for doc_id in document_ids if doc_id not in documents_by_id