Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Mark all affected dimension space points as changed on node move #5393

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading