From b1b1d4321b713c7d61a6c41cee4772d92a45c241 Mon Sep 17 00:00:00 2001 From: Denny Lubitz Date: Tue, 3 Dec 2024 16:55:13 +0100 Subject: [PATCH] BUGFIX: Mark all affected dimension space points as changed on node move. --- .../ChangeProjection.php | 8 +- ...2-MoveNodeAggregate_WithDimensions.feature | 118 +++++++++--------- 2 files changed, 61 insertions(+), 65 deletions(-) diff --git a/Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php b/Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php index da5c068067..4610a2f27f 100644 --- a/Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php +++ b/Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php @@ -218,18 +218,18 @@ private function whenNodeAggregateWasMoved(NodeAggregateWasMoved $event): void } $affectedDimensionSpacePoints = iterator_to_array($event->succeedingSiblingsForCoverage->toDimensionSpacePointSet()); - $arbitraryDimensionSpacePoint = reset($affectedDimensionSpacePoints); - if ($arbitraryDimensionSpacePoint instanceof DimensionSpacePoint) { + foreach ($affectedDimensionSpacePoints as $affectedDimensionSpacePoint) { + // always the case due to constraint enforcement (at least one DSP is selected and must have a succeeding sibling or null) - // WORKAROUND: we simply use the event's first DSP here as the origin dimension space point. + // WORKAROUND: we simply use the events DSPs here as the origin dimension space point. // But this DSP is not necessarily occupied. // @todo properly handle this by storing the necessary information in the projection $this->markAsMoved( $event->getContentStreamId(), $event->getNodeAggregateId(), - OriginDimensionSpacePoint::fromDimensionSpacePoint($arbitraryDimensionSpacePoint) + OriginDimensionSpacePoint::fromDimensionSpacePoint($affectedDimensionSpacePoint) ); } } diff --git a/Neos.Neos/Tests/Behavior/Features/Change/07-NodeMove/02-MoveNodeAggregate_WithDimensions.feature b/Neos.Neos/Tests/Behavior/Features/Change/07-NodeMove/02-MoveNodeAggregate_WithDimensions.feature index 1cb69da1bf..1dcdda49ca 100644 --- a/Neos.Neos/Tests/Behavior/Features/Change/07-NodeMove/02-MoveNodeAggregate_WithDimensions.feature +++ b/Neos.Neos/Tests/Behavior/Features/Change/07-NodeMove/02-MoveNodeAggregate_WithDimensions.feature @@ -108,53 +108,50 @@ Feature: Move node aggregate with dimensions | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} | And I expect the ChangeProjection to have no changes in "cs-identifier" -# TODO: https://github.com/neos/neos-development-collection/issues/5368 -# Scenario: Move nodeAggregate (variant) into new parent with gatherAll -# When I am in dimension space point {"language": "fr"} -# And the command MoveNodeAggregate is executed with payload: -# | Key | Value | -# | nodeAggregateId | "nody-mc-nodeface" | -# | newParentNodeAggregateId | "sir-nodeward-nodington-iv" | -# | relationDistributionStrategy | "gatherAll" | -# -# Then I expect the ChangeProjection to have the following changes in "user-cs-id": -# | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint | -# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} | -# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} | -# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} | -# And I expect the ChangeProjection to have no changes in "cs-identifier" - -# TODO: https://github.com/neos/neos-development-collection/issues/5368 -# Scenario: Move nodeAggregate (specialization) into new parent with gatherAll -# When I am in dimension space point {"language": "gsw"} -# And the command MoveNodeAggregate is executed with payload: -# | Key | Value | -# | nodeAggregateId | "nody-mc-nodeface" | -# | newParentNodeAggregateId | "sir-nodeward-nodington-iv" | -# | relationDistributionStrategy | "gatherAll" | -# -# Then I expect the ChangeProjection to have the following changes in "user-cs-id": -# | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint | -# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} | -# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} | -# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} | -# And I expect the ChangeProjection to have no changes in "cs-identifier" - -# TODO: https://github.com/neos/neos-development-collection/issues/5368 -# Scenario: Move nodeAggregate (generalization) into new parent with gatherAll -# When I am in dimension space point {"language": "de"} -# And the command MoveNodeAggregate is executed with payload: -# | Key | Value | -# | nodeAggregateId | "nody-mc-nodeface" | -# | newParentNodeAggregateId | "sir-nodeward-nodington-iv" | -# | relationDistributionStrategy | "gatherAll" | -# -# Then I expect the ChangeProjection to have the following changes in "user-cs-id": -# | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint | -# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} | -# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} | -# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} | -# And I expect the ChangeProjection to have no changes in "cs-identifier" + Scenario: Move nodeAggregate (variant) into new parent with gatherAll + When I am in dimension space point {"language": "fr"} + And the command MoveNodeAggregate is executed with payload: + | Key | Value | + | nodeAggregateId | "nody-mc-nodeface" | + | newParentNodeAggregateId | "sir-nodeward-nodington-iv" | + | relationDistributionStrategy | "gatherAll" | + + Then I expect the ChangeProjection to have the following changes in "user-cs-id": + | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint | + | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} | + | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} | + | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} | + And I expect the ChangeProjection to have no changes in "cs-identifier" + + Scenario: Move nodeAggregate (specialization) into new parent with gatherAll + When I am in dimension space point {"language": "gsw"} + And the command MoveNodeAggregate is executed with payload: + | Key | Value | + | nodeAggregateId | "nody-mc-nodeface" | + | newParentNodeAggregateId | "sir-nodeward-nodington-iv" | + | relationDistributionStrategy | "gatherAll" | + + Then I expect the ChangeProjection to have the following changes in "user-cs-id": + | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint | + | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} | + | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} | + | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} | + And I expect the ChangeProjection to have no changes in "cs-identifier" + + Scenario: Move nodeAggregate (generalization) into new parent with gatherAll + When I am in dimension space point {"language": "de"} + And the command MoveNodeAggregate is executed with payload: + | Key | Value | + | nodeAggregateId | "nody-mc-nodeface" | + | newParentNodeAggregateId | "sir-nodeward-nodington-iv" | + | relationDistributionStrategy | "gatherAll" | + + Then I expect the ChangeProjection to have the following changes in "user-cs-id": + | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint | + | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} | + | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} | + | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} | + And I expect the ChangeProjection to have no changes in "cs-identifier" Scenario: Move nodeAggregate (variant) into new parent with gatherSpecializations When I am in dimension space point {"language": "fr"} @@ -182,20 +179,19 @@ Feature: Move node aggregate with dimensions | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} | And I expect the ChangeProjection to have no changes in "cs-identifier" -# TODO: https://github.com/neos/neos-development-collection/issues/5368 -# Scenario: Move nodeAggregate (generalization) into new parent with gatherSpecializations -# When I am in dimension space point {"language": "de"} -# And the command MoveNodeAggregate is executed with payload: -# | Key | Value | -# | nodeAggregateId | "nody-mc-nodeface" | -# | newParentNodeAggregateId | "sir-nodeward-nodington-iv" | -# | relationDistributionStrategy | "gatherSpecializations" | -# -# Then I expect the ChangeProjection to have the following changes in "user-cs-id": -# | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint | -# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} | -# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} | -# And I expect the ChangeProjection to have no changes in "cs-identifier" + Scenario: Move nodeAggregate (generalization) into new parent with gatherSpecializations + When I am in dimension space point {"language": "de"} + And the command MoveNodeAggregate is executed with payload: + | Key | Value | + | nodeAggregateId | "nody-mc-nodeface" | + | newParentNodeAggregateId | "sir-nodeward-nodington-iv" | + | relationDistributionStrategy | "gatherSpecializations" | + + Then I expect the ChangeProjection to have the following changes in "user-cs-id": + | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint | + | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} | + | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} | + And I expect the ChangeProjection to have no changes in "cs-identifier" Scenario: Move nodeAggregate with children into new parent When I am in dimension space point {"language": "de"}