From 595fcba220240feedf74c451a5612719e3dbf53f Mon Sep 17 00:00:00 2001 From: Sebastian Helzle Date: Fri, 6 Oct 2023 08:17:07 +0200 Subject: [PATCH] BUGFIX: Only discard nodes in same workspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a node is moved in a sub workspace it’s possible that childnodes from the base workspace are returned and discarded. If the parent workspace is live, this will lead to an exception in the workspace module, if it’s another shared workspace it might even discard nodes from it. Resolves: #4577 --- .../Classes/Domain/Service/PublishingService.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php b/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php index 7e94b871b9c..0c352dea3df 100644 --- a/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php +++ b/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php @@ -182,8 +182,11 @@ protected function doDiscardNode(NodeInterface $node, array &$alreadyDiscardedNo if ($possibleShadowNodeData instanceof NodeData) { if ($possibleShadowNodeData->getMovedTo() !== null) { $parentBasePath = $node->getPath(); - $affectedChildNodeDataInSameWorkspace = $this->nodeDataRepository->findByParentAndNodeType($parentBasePath, null, $node->getWorkspace(), null, false, true); - foreach ($affectedChildNodeDataInSameWorkspace as $affectedChildNodeData) { + $affectedChildNodeDataInWorkspaceChain = $this->nodeDataRepository->findByParentAndNodeType($parentBasePath, null, $node->getWorkspace(), null, false, true); + foreach ($affectedChildNodeDataInWorkspaceChain as $affectedChildNodeData) { + if (!$affectedChildNodeData->matchesWorkspaceAndDimensions($node->getWorkspace(), $node->getDimensions())) { + continue; + } /** @var NodeData $affectedChildNodeData */ $affectedChildNode = $this->nodeFactory->createFromNodeData($affectedChildNodeData, $node->getContext()); $this->doDiscardNode($affectedChildNode, $alreadyDiscardedNodeIdentifiers);