Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Fix hidden state evaluation #3867

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions Classes/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
* source code.
*/

use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\Controller\ActionController;
Expand Down Expand Up @@ -226,9 +228,29 @@ public function redirectToAction(string $node): void

$nodeAddress = NodeAddress::fromJsonString($node);

$contentRepository = $this->contentRepositoryRegistry->get($nodeAddress->contentRepositoryId);

$nodeInstance = $contentRepository->getContentGraph($nodeAddress->workspaceName)->getSubgraph(
$nodeAddress->dimensionSpacePoint,
VisibilityConstraints::withoutRestrictions()
)->findNodeById($nodeAddress->aggregateId);

// we always want to redirect to the node in the base workspace.
mhsdesign marked this conversation as resolved.
Show resolved Hide resolved
$workspace = $contentRepository->getWorkspaceFinder()->findOneByName($nodeAddress->workspaceName);

$nodeAddressInBaseWorkspace = NodeAddress::create(
$nodeAddress->contentRepositoryId,
$workspace->baseWorkspaceName ?? WorkspaceName::forLive(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the selected workspace has no base workspace – shouldn't that be an error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i this is like one of these if ($siteNode) {} calls that are just there to prevent an error than to run into a fatal error.
If some logic is changed that we for example work on the live workspace directly we should also still be able to preview it ... but i think youre right ... for that case $workspace->baseWorkspaceName ?? $workspace->workspaceName should be enough;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted:)

$nodeAddress->dimensionSpacePoint,
$nodeAddress->aggregateId
);

$nodeUriBuilder = $this->nodeUriBuilderFactory->forActionRequest($this->request);

$this->redirectToUri(
$this->nodeUriBuilderFactory->forActionRequest($this->request)
->uriFor($nodeAddress)
$nodeInstance->tags->contain(SubtreeTag::disabled())
? $nodeUriBuilder->previewUriFor($nodeAddressInBaseWorkspace)
: $nodeUriBuilder->uriFor($nodeAddressInBaseWorkspace)
);
}
}
11 changes: 1 addition & 10 deletions Classes/Fusion/Helper/NodeInfoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,16 +356,7 @@ public function previewUri(Node $node, ActionRequest $actionRequest): string

public function createRedirectToNode(Node $node, ActionRequest $actionRequest): string
{
// we always want to redirect to the node in the base workspace.
$contentRepository = $this->contentRepositoryRegistry->get($node->contentRepositoryId);
$workspace = $contentRepository->getWorkspaceFinder()->findOneByName($node->workspaceName);

$nodeAddress = NodeAddress::create(
$node->contentRepositoryId,
$workspace->baseWorkspaceName ?? WorkspaceName::forLive(),
$node->dimensionSpacePoint,
$node->aggregateId
);
$nodeAddress = NodeAddress::fromNode($node);

$uriBuilder = new UriBuilder();
$uriBuilder->setRequest($actionRequest);
Expand Down
Loading