BUG: Cut & paste in different dimension leads to unpublishable change
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
When I copy a page to another dimension with copy & create, moving a content element with cut & past will move the element in all dimensions. Then a non-publishable change appears in the workspace that cannot be applied with 'publish', 'publish all' or using the workspace module.
Expected Behavior
I would expect to be able to publish/unpublish the change with 'publish all' or discard the change with 'discard changes' :
Steps To Reproduce
Using Neos Demo:
- Copy 'Features' -> 'Multiple columns' to german using the 'create & copy' feature
- Publish everything
- Copy 'Features' -> 'Text & images' to german using the 'create & copy' feature
- Publish everything
- Go to page 'Multiple columns' in german & cut the heading 'A Caucus-race and a Long Tale'
- Go to page 'Text & images' and paste the heading
Result: the element is moved in english and german and an unpublishable change appears
Environment
- Flow:
- Neos: 9.0
- PHP: 8.2
Anything else?
No response
Right now copying a document to another variant does no longer work in the first place. This should either prohibited in the UI or needs a concept what exactly is supposed to happen.
See Bernhards CopyNodesRecursively vs Content Dimensions in https://github.com/neos/neos-development-collection/issues/5054
Finally under review: https://github.com/neos/neos-ui/pull/3873
Thanks for the issue. I can reproduce this. And this is NOT related to copy (https://github.com/neos/neos-development-collection/issues/5054) nodes recursively as we variate here:
The publish button in de on any site:
The publish button in us on the site we moved the node to (Text & Images)
And indeed publish all (in site) and publish individual document does not work. The orange button is still orange and succeeding publish does nothing. A publish noop happens currently which will lead to an exception in the future: https://github.com/neos/neos-development-collection/pull/5337
This is an issue of combination of the change projection and that the Neos ui does not allow to specify how node move should work (that we gather by default all nodes: STRATEGY_GATHER_ALL - while we work on https://github.com/neos/neos-development-collection/pull/5314 we might want to introduce a dialog in the ui to fix this for content nodes).
WORKAROUND: we simply use the event's first DSP here as the origin dimension space point.
https://github.com/neos/neos-development-collection/blob/6597802d3dcd963f58cf75f4b6548726428c8800/Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php#L211-L232
by using an arbitrary dsp we only highlight us and not de, though the change was made in de. The resulting payload, the NodeIdsToPublishOrDiscard of the partial publish is:
Flow Variable Dump
Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdsToPublishOrDiscard(1)
integer 0 => Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdToPublishOrDiscard object
nodeAggregateId => Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId object
value => string "114dbcf4-bb74-4608-8ff8-56c09c5008b0" (36)
dimensionSpacePoint => Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint object
coordinates => array(1)
string "language" (8) => string "en_US" (5)
hash => string "046d33049fe2ab3d1c3c54ca5340186f" (32)
Though while separating the matching and remaining commands in and using matchesNodeId we compare that en_US matches de_DE:
https://github.com/neos/neos-development-collection/blob/1dc8c016c97bf56fb9d8565b9cb30e79eadb53d2/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php#L115-L119
As hotfix we could fix this to not care about dsps for the STRATEGY_GATHER_ALL - as all dimensions are affected i can confirm that this works
if ($this->relationDistributionStrategy === RelationDistributionStrategy::STRATEGY_GATHER_ALL) {
// dsp doesnt matter
return $this->nodeAggregateId->equals($nodeIdToPublish->nodeAggregateId);
}
But the real issue is that the original $dimensionSpacePoint is NOT part of the event and must be handled by the change projection to make the correct node as changed: This is also further described here: https://github.com/neos/neos-development-collection/issues/5360
Tests have been added here: https://github.com/neos/neos-development-collection/pull/5384/files#diff-d86d8dcc7cb78398ebf7af3266b121067680af0ba66dde88dbefc3b6ce5d1012