From 524f86389ebca9223991bd43ebff10c64ff6c7a4 Mon Sep 17 00:00:00 2001 From: Oleh Paduchak Date: Fri, 14 Nov 2025 13:45:13 +0200 Subject: [PATCH] implemented removal of contributors from all children of node --- api/nodes/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/nodes/views.py b/api/nodes/views.py index 36a31c97c67..87758f0a75f 100644 --- a/api/nodes/views.py +++ b/api/nodes/views.py @@ -545,13 +545,17 @@ def get_serializer_context(self): return context def perform_destroy(self, instance): - node = self.get_resource() + node: Node = self.get_resource() auth = get_user_auth(self.request) if node.visible_contributors.count() == 1 and instance.visible: raise ValidationError('Must have at least one visible contributor') removed = node.remove_contributor(instance, auth) if not removed: raise ValidationError('Must have at least one registered admin contributor') + propagate = self.request.query_params.get('propagate_to_children') == 'true' + if propagate: + for child_node in node.get_nodes(_contributors__in=[instance.user]): + child_node.remove_contributor(instance, auth) class NodeImplicitContributorsList(JSONAPIBaseView, generics.ListAPIView, ListFilterMixin, NodeMixin):