From dc4df57bcb5d3b03f56e6b9f1bf4c2bd19581e22 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:02:45 +0200 Subject: [PATCH] TASK: Fix hidden state evaluation in LinkingService and document new 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: https://github.com/neos/neos-ui/pull/3867 --- Neos.Neos/Classes/FrontendRouting/NodeUriBuilder.php | 1 + Neos.Neos/Classes/Service/LinkingService.php | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Neos.Neos/Classes/FrontendRouting/NodeUriBuilder.php b/Neos.Neos/Classes/FrontendRouting/NodeUriBuilder.php index 71fbd46e4d0..8e9f7e3b4de 100644 --- a/Neos.Neos/Classes/FrontendRouting/NodeUriBuilder.php +++ b/Neos.Neos/Classes/FrontendRouting/NodeUriBuilder.php @@ -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 diff --git a/Neos.Neos/Classes/Service/LinkingService.php b/Neos.Neos/Classes/Service/LinkingService.php index eb1e65f9961..aeb7cb30ee4 100644 --- a/Neos.Neos/Classes/Service/LinkingService.php +++ b/Neos.Neos/Classes/Service/LinkingService.php @@ -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