♻️(backend) reset collaboration connection in cascade for all children

When an access is updated or deleted, or a link_configuration is
changed, the collaration_service is used to reset the connection in the
collaboration server. As accesses and link_configuration are inherited
in a Docs tree, if the user is connected to a child, the connection is
not reset. This commit fix this issue by calling the reset on every
children in the tree.
This commit is contained in:
Manuel Raynaud
2026-07-09 14:46:11 +02:00
parent d1db000c76
commit d35b81a6ed
9 changed files with 326 additions and 33 deletions
+4 -3
View File
@@ -68,6 +68,7 @@ from core.services.search_indexers import (
get_document_indexer,
get_visited_document_ids_of,
)
from core.tasks.access import reset_service_connections_in_cascade
from core.tasks.mail import send_ask_for_access_mail
from core.utils.analytics import PosthogEventName, posthog_capture
from core.utils.paths import filter_descendants
@@ -1825,7 +1826,7 @@ class DocumentViewSet(
serializer.save()
# Notify collaboration server about the link updated
CollaborationService().reset_connections(str(document.id))
reset_service_connections_in_cascade.delay(str(document.id))
return drf.response.Response(serializer.data, status=drf.status.HTTP_200_OK)
@@ -2839,7 +2840,7 @@ class DocumentAccessViewSet(
access_user_id = str(access.user.id)
# Notify collaboration server about the access change
CollaborationService().reset_connections(
reset_service_connections_in_cascade.delay(
str(access.document.id), access_user_id
)
@@ -2860,7 +2861,7 @@ class DocumentAccessViewSet(
)
# Notify collaboration server about the access removed
CollaborationService().reset_connections(document_id, user_id)
reset_service_connections_in_cascade.delay(document_id, user_id)
class InvitationViewset(