📈(backend) capture an event when a document is duplicated

We want to capture an event when a document is duplicated. The document
from where come from the duplication is added in the properties.
This commit is contained in:
Manuel Raynaud
2026-06-01 17:41:56 +02:00
parent f4139e3ab0
commit d1476024a7
3 changed files with 188 additions and 66 deletions
+9
View File
@@ -1343,6 +1343,15 @@ class DocumentViewSet(
user=user,
)
posthog_capture(
PosthogEventName.DOC_DUPLICATED,
user,
{
"duplicated_from": str(document_to_duplicate.id),
},
document=duplicated_document,
)
return drf_response.Response(
{"id": str(duplicated_document.id)}, status=status.HTTP_201_CREATED
)