Skip to content

Commit

Permalink
Merge pull request #5393 from neos/90/bugfix/mark-all-affected-dimens…
Browse files Browse the repository at this point in the history
…ions-on-move

BUGFIX: Mark all affected dimension space points as changed on node move
  • Loading branch information
mhsdesign authored Dec 12, 2024
2 parents 8236bb8 + 8b63013 commit 84c0e70
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 67 deletions.
11 changes: 5 additions & 6 deletions Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,17 @@ 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.
// But this DSP is not necessarily occupied.
// @todo properly handle this by storing the necessary information in the projection
// We simply use the events DSPs here to store them as `Change` in even if the DSP is not necessarily occupied.
// this is not problematic as the DSP should only be used for providing additional information where a change has effects instead of locating its origin
// todo possibly rename in the `Change` the field to '$affectedDimensionSpacePoint' field instead, as well use it now like that.

$this->markAsMoved(
$event->getContentStreamId(),
$event->getNodeAggregateId(),
OriginDimensionSpacePoint::fromDimensionSpacePoint($arbitraryDimensionSpacePoint)
OriginDimensionSpacePoint::fromDimensionSpacePoint($affectedDimensionSpacePoint)
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down Expand Up @@ -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"}
Expand Down

0 comments on commit 84c0e70

Please sign in to comment.