Skip to content

Commit

Permalink
BUGFIX: Only discard nodes in same workspace
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Sebobo committed Oct 6, 2023
1 parent f328dd8 commit 595fcba
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 595fcba

Please sign in to comment.