Skip to content

Commit

Permalink
BUGFIX: Mark all affected dimension space points as changed on node m…
Browse files Browse the repository at this point in the history
…ove.
  • Loading branch information
dlubitz committed Dec 3, 2024
1 parent 519c03f commit b1b1d43
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
}
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 b1b1d43

Please sign in to comment.