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

!!! TASK: 9.0 Set nodeName to null for regular created nodes #3515

Merged
merged 5 commits into from
Sep 29, 2023
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
6 changes: 3 additions & 3 deletions Classes/Domain/Model/Changes/AbstractCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ protected function createNode(
if (is_null($nodeTypeName)) {
throw new \RuntimeException('Cannot run createNode without a set node type.', 1645577794);
}
// TODO: the $name=... line should be as expressed below
// $name = $this->getName() ?: $this->nodeService->generateUniqueNodeName($parent->findParentNode());
$nodeName = NodeName::fromString($this->getName() ?: uniqid('node-', false));
$nodeName = $this->getName()
? NodeName::fromString($this->getName())
: null;

$nodeAggregateId = NodeAggregateId::create(); // generate a new NodeAggregateId

Expand Down
4 changes: 2 additions & 2 deletions Classes/Domain/Model/Changes/AbstractStructuralChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\NodeType\NodeType;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
Expand All @@ -25,7 +26,6 @@
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\RenderContentOutOfBand;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\UpdateNodeInfo;
use Neos\Neos\Ui\Domain\Model\RenderedNodeDomAddress;
use Neos\Neos\Ui\Fusion\Helper\NodeInfoHelper;

/**
* A change that performs structural actions like moving or creating nodes
Expand Down Expand Up @@ -187,7 +187,7 @@ protected function findChildNodes(Node $node): Nodes
protected function isNodeTypeAllowedAsChildNode(Node $node, NodeType $nodeType): bool
{
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
if (NodeInfoHelper::isAutoCreated($node, $subgraph)) {
if ($node->classification === NodeAggregateClassification::CLASSIFICATION_TETHERED) {
$parentNode = $subgraph->findParentNode($node->nodeAggregateId);
return !$parentNode || $parentNode->nodeType->allowsGrandchildNodeType(
$node->nodeName->value,
Expand Down
14 changes: 2 additions & 12 deletions Classes/Fusion/Helper/NodeInfoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes;
use Neos\ContentRepository\Core\Projection\NodeHiddenState\NodeHiddenStateFinder;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Eel\ProtectedContextAwareInterface;
use Neos\Flow\Annotations as Flow;
Expand Down Expand Up @@ -236,7 +237,7 @@ protected function getBasicNodeInformation(Node $node): array
'identifier' => $node->nodeAggregateId->jsonSerialize(),
'nodeType' => $node->nodeType->getName(),
'label' => $node->getLabel(),
'isAutoCreated' => self::isAutoCreated($node, $subgraph),
'isAutoCreated' => $node->classification === NodeAggregateClassification::CLASSIFICATION_TETHERED,
// TODO: depth is expensive to calculate; maybe let's get rid of this?
'depth' => $subgraph->countAncestorNodes(
$node->nodeAggregateId,
Expand All @@ -251,17 +252,6 @@ protected function getBasicNodeInformation(Node $node): array
];
}

public static function isAutoCreated(Node $node, ContentSubgraphInterface $subgraph): bool
{
$parent = $subgraph->findParentNode($node->nodeAggregateId);
if ($parent) {
if (array_key_exists($node->nodeName->value, $parent->nodeType->getAutoCreatedChildNodes())) {
return true;
}
}
return false;
}

/**
* Get information for all children of the given parent node.
*
Expand Down
Loading