|
12 | 12 | * source code.
|
13 | 13 | */
|
14 | 14 |
|
| 15 | +use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; |
15 | 16 | use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
|
16 | 17 | use Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist;
|
17 | 18 | use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
|
@@ -225,9 +226,29 @@ public function redirectToAction(string $node): void
|
225 | 226 |
|
226 | 227 | $nodeAddress = NodeAddress::fromJsonString($node);
|
227 | 228 |
|
| 229 | + $contentRepository = $this->contentRepositoryRegistry->get($nodeAddress->contentRepositoryId); |
| 230 | + |
| 231 | + $nodeInstance = $contentRepository->getContentGraph($nodeAddress->workspaceName)->getSubgraph( |
| 232 | + $nodeAddress->dimensionSpacePoint, |
| 233 | + VisibilityConstraints::withoutRestrictions() |
| 234 | + )->findNodeById($nodeAddress->aggregateId); |
| 235 | + |
| 236 | + $workspace = $contentRepository->findWorkspaceByName($nodeAddress->workspaceName); |
| 237 | + |
| 238 | + // we always want to redirect to the node in the base workspace unless we are on a root workspace in which case we stay on that (currently that will not happen) |
| 239 | + $nodeAddressInBaseWorkspace = NodeAddress::create( |
| 240 | + $nodeAddress->contentRepositoryId, |
| 241 | + $workspace->baseWorkspaceName ?? $nodeAddress->workspaceName, |
| 242 | + $nodeAddress->dimensionSpacePoint, |
| 243 | + $nodeAddress->aggregateId |
| 244 | + ); |
| 245 | + |
| 246 | + $nodeUriBuilder = $this->nodeUriBuilderFactory->forActionRequest($this->request); |
| 247 | + |
228 | 248 | $this->redirectToUri(
|
229 |
| - $this->nodeUriBuilderFactory->forActionRequest($this->request) |
230 |
| - ->uriFor($nodeAddress) |
| 249 | + !$nodeInstance || $nodeInstance->tags->contain(SubtreeTag::disabled()) |
| 250 | + ? $nodeUriBuilder->previewUriFor($nodeAddressInBaseWorkspace) |
| 251 | + : $nodeUriBuilder->uriFor($nodeAddressInBaseWorkspace) |
231 | 252 | );
|
232 | 253 | }
|
233 | 254 | }
|
0 commit comments