Skip to content

Commit

Permalink
Merge branch '9.0' into feature/3732-cr-privileges
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaidelich committed Oct 25, 2024
2 parents 9103145 + c4dcecc commit f7dfbba
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
45 changes: 29 additions & 16 deletions Classes/ContentRepository/Service/WorkspaceService.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Neos\Neos\Ui\ContentRepository\Service;

/*
Expand All @@ -14,8 +15,8 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindClosestNodeFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
Expand Down Expand Up @@ -51,11 +52,12 @@ class WorkspaceService
public function getPublishableNodeInfo(WorkspaceName $workspaceName, ContentRepositoryId $contentRepositoryId): array
{
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
$contentGraph = $contentRepository->getContentGraph($workspaceName);
$pendingChanges = $this->workspacePublishingService->pendingWorkspaceChanges($contentRepositoryId, $workspaceName);
/** @var array{contextPath:string,documentContextPath:string,typeOfChange:int}[] $unpublishedNodes */
$unpublishedNodes = [];
foreach ($pendingChanges as $change) {
if ($change->removalAttachmentPoint) {
if ($change->removalAttachmentPoint && $change->originDimensionSpacePoint !== null) {
$nodeAddress = NodeAddress::create(
$contentRepositoryId,
$workspaceName,
Expand All @@ -79,20 +81,31 @@ public function getPublishableNodeInfo(WorkspaceName $workspaceName, ContentRepo
'typeOfChange' => $this->getTypeOfChange($change)
];
} else {
$subgraph = $contentRepository->getContentGraph($workspaceName)->getSubgraph(
$change->originDimensionSpacePoint->toDimensionSpacePoint(),
VisibilityConstraints::withoutRestrictions()
);
$node = $subgraph->findNodeById($change->nodeAggregateId);

if ($node instanceof Node) {
$documentNode = $subgraph->findClosestNode($node->aggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT));
if ($documentNode instanceof Node) {
$unpublishedNodes[] = [
'contextPath' => NodeAddress::fromNode($node)->toJson(),
'documentContextPath' => NodeAddress::fromNode($documentNode)->toJson(),
'typeOfChange' => $this->getTypeOfChange($change)
];
if ($change->originDimensionSpacePoint !== null) {
$originDimensionSpacePoints = [$change->originDimensionSpacePoint];
} else {
// If originDimensionSpacePoint is null, we have a change to the nodeAggregate. All nodes in the
// occupied dimensionspacepoints shall be marked as changed.
$originDimensionSpacePoints = $contentGraph
->findNodeAggregateById($change->nodeAggregateId)
?->occupiedDimensionSpacePoints ?: [];
}

foreach ($originDimensionSpacePoints as $originDimensionSpacePoint) {
$subgraph = $contentGraph->getSubgraph(
$originDimensionSpacePoint->toDimensionSpacePoint(),
VisibilityConstraints::withoutRestrictions()
);
$node = $subgraph->findNodeById($change->nodeAggregateId);
if ($node instanceof Node) {
$documentNode = $subgraph->findClosestNode($node->aggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT));
if ($documentNode instanceof Node) {
$unpublishedNodes[] = [
'contextPath' => NodeAddress::fromNode($node)->toJson(),
'documentContextPath' => NodeAddress::fromNode($documentNode)->toJson(),
'typeOfChange' => $this->getTypeOfChange($change)
];
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Service/NodePropertyConverterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private function getReference(Node $node, string $referenceName): array|string|n
private function getProperty(Node $node, string $propertyName): mixed
{
if ($propertyName === '_hidden') {
return $node->tags->contain(SubtreeTag::fromString('disabled'));
return $node->tags->withoutInherited()->contain(SubtreeTag::fromString('disabled'));
}

$propertyValue = $node->getProperty($propertyName);
Expand Down

0 comments on commit f7dfbba

Please sign in to comment.