From 965d08c08ecabde8da0806767bce540fad2dea3b Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Mon, 21 Oct 2024 23:43:33 +0200 Subject: [PATCH 1/5] BUGFIX: Skip `null` when publishing nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `getNodeFromContextPath(…)` in the Neos.Ui `NodeService` may return `null`, passing these to `publishNodde(…)` fails. This change adds a check and skips those nodes. --- Classes/Controller/BackendServiceController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Classes/Controller/BackendServiceController.php b/Classes/Controller/BackendServiceController.php index 54dfa87b20..0f8e2a9ab3 100644 --- a/Classes/Controller/BackendServiceController.php +++ b/Classes/Controller/BackendServiceController.php @@ -237,6 +237,14 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa foreach ($nodeContextPaths as $contextPath) { $node = $this->nodeService->getNodeFromContextPath($contextPath, null, null, true); + if ($node === null) { + $error = new Info(); + $error->setMessage(sprintf('Could not find node for context path "%s"', $contextPath)); + + $this->feedbackCollection->add($error); + + continue; + } $this->publishingService->publishNode($node, $targetWorkspace); if ($node->getNodeType()->isAggregate()) { From 139cfee867252367280c351cbc58f063a9258a7c Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Mon, 21 Oct 2024 23:59:32 +0200 Subject: [PATCH 2/5] BUGFIX: Skip null when updating workspace info A variant of the (potential) error fixed in the previous commit. --- Classes/Controller/BackendServiceController.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Classes/Controller/BackendServiceController.php b/Classes/Controller/BackendServiceController.php index 0f8e2a9ab3..cae2de946d 100644 --- a/Classes/Controller/BackendServiceController.php +++ b/Classes/Controller/BackendServiceController.php @@ -189,11 +189,18 @@ protected function updateWorkspaceInfo(string $documentNodeContextPath): void { $updateWorkspaceInfo = new UpdateWorkspaceInfo(); $documentNode = $this->nodeService->getNodeFromContextPath($documentNodeContextPath, null, null, true); - $updateWorkspaceInfo->setWorkspace( - $documentNode->getContext()->getWorkspace() - ); + if ($documentNode === null) { + $error = new Error(); + $error->setMessage(sprintf('Could not find node for document node context path "%s"', $documentNodeContextPath)); + + $this->feedbackCollection->add($error); + } else { + $updateWorkspaceInfo->setWorkspace( + $documentNode->getContext()->getWorkspace() + ); - $this->feedbackCollection->add($updateWorkspaceInfo); + $this->feedbackCollection->add($updateWorkspaceInfo); + } } /** From e888d7a6638c4f80c4b91ea46512178bf665d492 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 1 Dec 2024 14:11:13 +0100 Subject: [PATCH 3/5] BUGFIX: Hide paste button in inline ui if no nodes are in clipboard --- .../InlineUI/NodeToolbar/Buttons/PasteClipBoardNode/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/neos-ui-guest-frame/src/InlineUI/NodeToolbar/Buttons/PasteClipBoardNode/index.js b/packages/neos-ui-guest-frame/src/InlineUI/NodeToolbar/Buttons/PasteClipBoardNode/index.js index 79f255a60a..c9bebb3b53 100644 --- a/packages/neos-ui-guest-frame/src/InlineUI/NodeToolbar/Buttons/PasteClipBoardNode/index.js +++ b/packages/neos-ui-guest-frame/src/InlineUI/NodeToolbar/Buttons/PasteClipBoardNode/index.js @@ -15,7 +15,7 @@ import {selectors, actions} from '@neos-project/neos-ui-redux-store'; return (state, {contextPath}) => { const clipboardNodesContextPaths = selectors.CR.Nodes.clipboardNodesContextPathsSelector(state); - const canBePasted = (clipboardNodesContextPaths.every(clipboardNodeContextPath => { + const canBePasted = clipboardNodesContextPaths.length && (clipboardNodesContextPaths.every(clipboardNodeContextPath => { return canBePastedSelector(state, { subject: clipboardNodeContextPath, reference: contextPath From 0e6c71ce1f4270a1b9beb70089c4c0095774d715 Mon Sep 17 00:00:00 2001 From: Marc Henry Schultz <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:12:56 +0100 Subject: [PATCH 4/5] BUGFIX: Add content element wrapping to restricted nodes (#3888) Previously opening a document where some nodes were not permitted to be edited was hard to navigate, as the content element wrapping was not rendered. Clicking into the elements showed no outline and navigation via the content tree was not possible. But more importantly inserting nodes into the content collection were likely misplaced until reloading as the Neos Ui does not understand the structure of the site. Instead - as reading the nodes and its information is permitted and needed for rendering - we will always wrap content elements if editable or not. To avoid having to boot the ckeditor for inline elements we instead evaluate the edit permission there and decide to hide the inline element wrapping. (Previously they would be rendered but not booted because the neos ui didnt had the outer content element wrapping) --- Classes/Aspects/AugmentationAspect.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Classes/Aspects/AugmentationAspect.php b/Classes/Aspects/AugmentationAspect.php index 1138d150de..c29f45d82d 100644 --- a/Classes/Aspects/AugmentationAspect.php +++ b/Classes/Aspects/AugmentationAspect.php @@ -145,6 +145,10 @@ public function editableElementAugmentation(JoinPointInterface $joinPoint) return $content; } + if ($this->nodeAuthorizationService->isGrantedToEditNode($node) === false) { + return $content; + } + $content = $joinPoint->getAdviceChain()->proceed($joinPoint); $attributes = [ @@ -166,6 +170,6 @@ protected function needsMetadata(NodeInterface $node, $renderCurrentDocumentMeta /** @var $contentContext ContentContext */ $contentContext = $node->getContext(); - return ($contentContext->isInBackend() === true && ($renderCurrentDocumentMetadata === true || $this->nodeAuthorizationService->isGrantedToEditNode($node) === true)); + return $contentContext->isInBackend() === true || $renderCurrentDocumentMetadata === true; } } From b628c59364d5391fd1e3c852a037e85c06b8ae1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20G=C3=BCnther?= Date: Fri, 13 Dec 2024 11:29:38 +0100 Subject: [PATCH 5/5] BUGFIX: Prevent proptype warning regarding canBePasted property (#3900) If clipboardNodesContextPaths.length is 0, this part will be interpreted as false (because 0 is considered "falsy" in JavaScript). The entire expression will then be 0 without evaluating the second part. This happens due to short-circuit evaluation in JavaScript. With this change we ensure that the value is always a boolean value. --- .../InlineUI/NodeToolbar/Buttons/PasteClipBoardNode/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/neos-ui-guest-frame/src/InlineUI/NodeToolbar/Buttons/PasteClipBoardNode/index.js b/packages/neos-ui-guest-frame/src/InlineUI/NodeToolbar/Buttons/PasteClipBoardNode/index.js index c9bebb3b53..fecf882255 100644 --- a/packages/neos-ui-guest-frame/src/InlineUI/NodeToolbar/Buttons/PasteClipBoardNode/index.js +++ b/packages/neos-ui-guest-frame/src/InlineUI/NodeToolbar/Buttons/PasteClipBoardNode/index.js @@ -15,7 +15,7 @@ import {selectors, actions} from '@neos-project/neos-ui-redux-store'; return (state, {contextPath}) => { const clipboardNodesContextPaths = selectors.CR.Nodes.clipboardNodesContextPathsSelector(state); - const canBePasted = clipboardNodesContextPaths.length && (clipboardNodesContextPaths.every(clipboardNodeContextPath => { + const canBePasted = Boolean(clipboardNodesContextPaths.length && clipboardNodesContextPaths.every(clipboardNodeContextPath => { return canBePastedSelector(state, { subject: clipboardNodeContextPath, reference: contextPath