Skip to content

Commit 84c0e70

Browse files
authored
Merge pull request #5393 from neos/90/bugfix/mark-all-affected-dimensions-on-move
BUGFIX: Mark all affected dimension space points as changed on node move
2 parents 8236bb8 + 8b63013 commit 84c0e70

File tree

2 files changed

+62
-67
lines changed

2 files changed

+62
-67
lines changed

Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,18 +218,17 @@ private function whenNodeAggregateWasMoved(NodeAggregateWasMoved $event): void
218218
}
219219

220220
$affectedDimensionSpacePoints = iterator_to_array($event->succeedingSiblingsForCoverage->toDimensionSpacePointSet());
221-
$arbitraryDimensionSpacePoint = reset($affectedDimensionSpacePoints);
222-
if ($arbitraryDimensionSpacePoint instanceof DimensionSpacePoint) {
221+
foreach ($affectedDimensionSpacePoints as $affectedDimensionSpacePoint) {
223222
// always the case due to constraint enforcement (at least one DSP is selected and must have a succeeding sibling or null)
224223

225-
// WORKAROUND: we simply use the event's first DSP here as the origin dimension space point.
226-
// But this DSP is not necessarily occupied.
227-
// @todo properly handle this by storing the necessary information in the projection
224+
// We simply use the events DSPs here to store them as `Change` in even if the DSP is not necessarily occupied.
225+
// 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
226+
// todo possibly rename in the `Change` the field to '$affectedDimensionSpacePoint' field instead, as well use it now like that.
228227

229228
$this->markAsMoved(
230229
$event->getContentStreamId(),
231230
$event->getNodeAggregateId(),
232-
OriginDimensionSpacePoint::fromDimensionSpacePoint($arbitraryDimensionSpacePoint)
231+
OriginDimensionSpacePoint::fromDimensionSpacePoint($affectedDimensionSpacePoint)
233232
);
234233
}
235234
}

Neos.Neos/Tests/Behavior/Features/PendingChanges/07-NodeMove/02-MoveNodeAggregate_WithDimensions.feature

Lines changed: 57 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -108,53 +108,50 @@ Feature: Move node aggregate with dimensions
108108
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} |
109109
And I expect the ChangeProjection to have no changes in "cs-identifier"
110110

111-
# TODO: https://github.com/neos/neos-development-collection/issues/5368
112-
# Scenario: Move nodeAggregate (variant) into new parent with gatherAll
113-
# When I am in dimension space point {"language": "fr"}
114-
# And the command MoveNodeAggregate is executed with payload:
115-
# | Key | Value |
116-
# | nodeAggregateId | "nody-mc-nodeface" |
117-
# | newParentNodeAggregateId | "sir-nodeward-nodington-iv" |
118-
# | relationDistributionStrategy | "gatherAll" |
119-
#
120-
# Then I expect the ChangeProjection to have the following changes in "user-cs-id":
121-
# | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
122-
# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} |
123-
# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} |
124-
# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} |
125-
# And I expect the ChangeProjection to have no changes in "cs-identifier"
126-
127-
# TODO: https://github.com/neos/neos-development-collection/issues/5368
128-
# Scenario: Move nodeAggregate (specialization) into new parent with gatherAll
129-
# When I am in dimension space point {"language": "gsw"}
130-
# And the command MoveNodeAggregate is executed with payload:
131-
# | Key | Value |
132-
# | nodeAggregateId | "nody-mc-nodeface" |
133-
# | newParentNodeAggregateId | "sir-nodeward-nodington-iv" |
134-
# | relationDistributionStrategy | "gatherAll" |
135-
#
136-
# Then I expect the ChangeProjection to have the following changes in "user-cs-id":
137-
# | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
138-
# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} |
139-
# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} |
140-
# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} |
141-
# And I expect the ChangeProjection to have no changes in "cs-identifier"
142-
143-
# TODO: https://github.com/neos/neos-development-collection/issues/5368
144-
# Scenario: Move nodeAggregate (generalization) into new parent with gatherAll
145-
# When I am in dimension space point {"language": "de"}
146-
# And the command MoveNodeAggregate is executed with payload:
147-
# | Key | Value |
148-
# | nodeAggregateId | "nody-mc-nodeface" |
149-
# | newParentNodeAggregateId | "sir-nodeward-nodington-iv" |
150-
# | relationDistributionStrategy | "gatherAll" |
151-
#
152-
# Then I expect the ChangeProjection to have the following changes in "user-cs-id":
153-
# | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
154-
# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} |
155-
# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} |
156-
# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} |
157-
# And I expect the ChangeProjection to have no changes in "cs-identifier"
111+
Scenario: Move nodeAggregate (variant) into new parent with gatherAll
112+
When I am in dimension space point {"language": "fr"}
113+
And the command MoveNodeAggregate is executed with payload:
114+
| Key | Value |
115+
| nodeAggregateId | "nody-mc-nodeface" |
116+
| newParentNodeAggregateId | "sir-nodeward-nodington-iv" |
117+
| relationDistributionStrategy | "gatherAll" |
118+
119+
Then I expect the ChangeProjection to have the following changes in "user-cs-id":
120+
| nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
121+
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} |
122+
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} |
123+
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} |
124+
And I expect the ChangeProjection to have no changes in "cs-identifier"
125+
126+
Scenario: Move nodeAggregate (specialization) into new parent with gatherAll
127+
When I am in dimension space point {"language": "gsw"}
128+
And the command MoveNodeAggregate is executed with payload:
129+
| Key | Value |
130+
| nodeAggregateId | "nody-mc-nodeface" |
131+
| newParentNodeAggregateId | "sir-nodeward-nodington-iv" |
132+
| relationDistributionStrategy | "gatherAll" |
133+
134+
Then I expect the ChangeProjection to have the following changes in "user-cs-id":
135+
| nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
136+
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} |
137+
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} |
138+
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} |
139+
And I expect the ChangeProjection to have no changes in "cs-identifier"
140+
141+
Scenario: Move nodeAggregate (generalization) into new parent with gatherAll
142+
When I am in dimension space point {"language": "de"}
143+
And the command MoveNodeAggregate is executed with payload:
144+
| Key | Value |
145+
| nodeAggregateId | "nody-mc-nodeface" |
146+
| newParentNodeAggregateId | "sir-nodeward-nodington-iv" |
147+
| relationDistributionStrategy | "gatherAll" |
148+
149+
Then I expect the ChangeProjection to have the following changes in "user-cs-id":
150+
| nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
151+
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} |
152+
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "fr"} |
153+
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} |
154+
And I expect the ChangeProjection to have no changes in "cs-identifier"
158155

159156
Scenario: Move nodeAggregate (variant) into new parent with gatherSpecializations
160157
When I am in dimension space point {"language": "fr"}
@@ -182,20 +179,19 @@ Feature: Move node aggregate with dimensions
182179
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} |
183180
And I expect the ChangeProjection to have no changes in "cs-identifier"
184181

185-
# TODO: https://github.com/neos/neos-development-collection/issues/5368
186-
# Scenario: Move nodeAggregate (generalization) into new parent with gatherSpecializations
187-
# When I am in dimension space point {"language": "de"}
188-
# And the command MoveNodeAggregate is executed with payload:
189-
# | Key | Value |
190-
# | nodeAggregateId | "nody-mc-nodeface" |
191-
# | newParentNodeAggregateId | "sir-nodeward-nodington-iv" |
192-
# | relationDistributionStrategy | "gatherSpecializations" |
193-
#
194-
# Then I expect the ChangeProjection to have the following changes in "user-cs-id":
195-
# | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
196-
# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} |
197-
# | nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} |
198-
# And I expect the ChangeProjection to have no changes in "cs-identifier"
182+
Scenario: Move nodeAggregate (generalization) into new parent with gatherSpecializations
183+
When I am in dimension space point {"language": "de"}
184+
And the command MoveNodeAggregate is executed with payload:
185+
| Key | Value |
186+
| nodeAggregateId | "nody-mc-nodeface" |
187+
| newParentNodeAggregateId | "sir-nodeward-nodington-iv" |
188+
| relationDistributionStrategy | "gatherSpecializations" |
189+
190+
Then I expect the ChangeProjection to have the following changes in "user-cs-id":
191+
| nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
192+
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "de"} |
193+
| nody-mc-nodeface | 0 | 0 | 1 | 0 | {"language": "gsw"} |
194+
And I expect the ChangeProjection to have no changes in "cs-identifier"
199195

200196
Scenario: Move nodeAggregate with children into new parent
201197
When I am in dimension space point {"language": "de"}

0 commit comments

Comments
 (0)