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

BUG: Cut & paste in different dimension leads to unpublishable change #4614

Open
1 task done
pKallert opened this issue Oct 13, 2023 · 4 comments
Open
1 task done
Assignees

Comments

@pKallert
Copy link
Contributor

Is there an existing issue for this?

  • 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' :
Bildschirmfoto 2023-10-13 um 13 27 23

Steps To Reproduce

Using Neos Demo:

  1. Copy 'Features' -> 'Multiple columns' to german using the 'create & copy' feature
  2. Publish everything
  3. Copy 'Features' -> 'Text & images' to german using the 'create & copy' feature
  4. Publish everything
  5. Go to page 'Multiple columns' in german & cut the heading 'A Caucus-race and a Long Tale'
  6. 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

@nezaniel

This comment was marked as outdated.

@ahaeslich ahaeslich moved this from Todo to Prioritized 🔥 in Neos 9.0 Release Board Sep 13, 2024
@mhsdesign

This comment was marked as outdated.

@skurfuerst skurfuerst moved this from Prioritized 🔥 to In Progress 🚧 in Neos 9.0 Release Board Sep 13, 2024
@skurfuerst

This comment was marked as outdated.

@skurfuerst skurfuerst moved this from In Progress 🚧 to Under Review 👀 in Neos 9.0 Release Board Oct 21, 2024
@mhsdesign
Copy link
Member

mhsdesign commented Nov 12, 2024

Thanks for the issue. I can reproduce this. And this is NOT related to copy (#5054) nodes recursively as we variate here:

image

The publish button in de on any site:

image

The publish button in us on the site we moved the node to (Text & Images)

image

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: #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 #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.

private function whenNodeAggregateWasMoved(NodeAggregateWasMoved $event): void
{
if ($event->workspaceName->isLive()) {
return;
}
$affectedDimensionSpacePoints = iterator_to_array($event->succeedingSiblingsForCoverage->toDimensionSpacePointSet());
$arbitraryDimensionSpacePoint = reset($affectedDimensionSpacePoints);
if ($arbitraryDimensionSpacePoint instanceof DimensionSpacePoint) {
// 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
$this->markAsMoved(
$event->getContentStreamId(),
$event->getNodeAggregateId(),
OriginDimensionSpacePoint::fromDimensionSpacePoint($arbitraryDimensionSpacePoint)
);
}
}

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:

public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool
{
return $this->nodeAggregateId->equals($nodeIdToPublish->nodeAggregateId)
&& $this->dimensionSpacePoint === $nodeIdToPublish->dimensionSpacePoint;
}

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: #5360

mhsdesign added a commit to mhsdesign/neos-development-collection that referenced this issue Nov 15, 2024
@mhsdesign mhsdesign moved this from Under Review 👀 to In Progress 🚧 in Neos 9.0 Release Board Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress 🚧
Development

No branches or pull requests

6 participants