Skip to content

Commit

Permalink
TASK: Fix hidden state evaluation in LinkingService and document new …
Browse files Browse the repository at this point in the history
…uri builder behaviour

This was accidentally wrongly migrated.

Regarding
> Why do we evaluate the hidden state here? We dont do it in the new uri builder.

We dont evaluate the hidden state in the new uri builder because we only have the node address at hand. The 8.3 logic

```
$action = $node->getContext()->getWorkspace()->isPublicWorkspace() && !$node->isHidden() ? 'show' : 'preview';
```

Ensured if youre routing to a hidden live node then a preview uri will be built. This is mostly unlikely going to happen and building the preview uri in this case is possibly not even the desired behaviour

One exception, in the Neos.Ui requires this behaviour: neos/neos-ui#3867
  • Loading branch information
mhsdesign committed Oct 14, 2024
1 parent c0f424a commit dc4df57
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions Neos.Neos/Classes/FrontendRouting/NodeUriBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public function __construct(
* @api
* @throws NoMatchingRouteException
* The exception is thrown for various unlike cases in which uri building fails:
* - the node is disabled in the live workspace (a preview url should be built instead)
* - the default route definitions are misconfigured
* - the custom uri building options don't macht a route
* - the shortcut points to an invalid target
Expand Down
3 changes: 1 addition & 2 deletions Neos.Neos/Classes/Service/LinkingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,7 @@ public function createNodeUri(
$mainRequest = $controllerContext->getRequest()->getMainRequest();
$uriBuilder = clone $controllerContext->getUriBuilder();
$uriBuilder->setRequest($mainRequest);
// todo why do we evaluate the hidden state here? We dont do it in the new uri builder.
$createLiveUri = $workspace && $workspace->isPublicWorkspace() && $resolvedNode->tags->contain(SubtreeTag::disabled());
$createLiveUri = $workspace && $workspace->isPublicWorkspace() && !$resolvedNode->tags->contain(SubtreeTag::disabled());

if ($addQueryString === true) {
// legacy feature see https://github.com/neos/neos-development-collection/issues/5076
Expand Down

0 comments on commit dc4df57

Please sign in to comment.