diff --git a/src/backend/core/api/viewsets.py b/src/backend/core/api/viewsets.py index 930dce20c..ce8911711 100644 --- a/src/backend/core/api/viewsets.py +++ b/src/backend/core/api/viewsets.py @@ -795,14 +795,6 @@ class DocumentViewSet( """Override to implement a soft delete instead of dumping the record in database.""" instance.soft_delete() - # the collaboration server holds the content: until it is told, it goes - # on serving the document to the clients editing it. On commit, because - # the task reads back what was just written to know what to report — it - # would find the document alive and restore it instead - transaction.on_commit( - partial(sync_service_deletions_in_cascade.delay, str(instance.id)) - ) - posthog_capture( PosthogEventName.DOC_DELETED, self.request.user, {}, document=instance ) diff --git a/src/backend/core/tests/documents/test_api_documents_delete.py b/src/backend/core/tests/documents/test_api_documents_delete.py index 6672b1376..f89503eb7 100644 --- a/src/backend/core/tests/documents/test_api_documents_delete.py +++ b/src/backend/core/tests/documents/test_api_documents_delete.py @@ -148,32 +148,3 @@ def test_api_documents_delete_authenticated_owner(via, mock_user_teams): {}, document=document, ) - - -def test_api_documents_delete_reports_the_deletion_to_the_collaboration_server( - django_capture_on_commit_callbacks, -): - """ - Deleting a document should tell the collaboration server, which holds its - content and would otherwise go on serving it to the clients editing it. - """ - user = factories.UserFactory() - document = factories.DocumentFactory(users=[(user, "owner")]) - child = factories.DocumentFactory(parent=document) - - client = APIClient() - client.force_login(user) - - # the report is made once the deletion is committed: the task reads it back - with ( - mock.patch("core.tasks.documents.YHubService") as mock_service, - django_capture_on_commit_callbacks(execute=True), - ): - response = client.delete(f"/api/v1.0/documents/{document.id!s}/") - - assert response.status_code == 204 - # the subtree goes with it - assert mock_service.return_value.delete_ydoc.call_args_list == [ - mock.call(document), - mock.call(child), - ]