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: Adjust to removed Neos WorkspaceName #3624

Merged
merged 3 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 6 additions & 7 deletions Classes/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
*/

use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Neos\Domain\Model\WorkspaceName as NeosWorkspaceName;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\Controller\ActionController;
use Neos\Flow\Mvc\View\ViewInterface;
use Neos\Flow\Persistence\PersistenceManagerInterface;
use Neos\Flow\ResourceManagement\ResourceManager;
use Neos\Flow\Security\Context;
use Neos\Flow\Session\SessionInterface;
use Neos\Fusion\View\FusionView;
use Neos\Neos\Controller\Backend\MenuHelper;
use Neos\Neos\Domain\Repository\DomainRepository;
use Neos\Neos\Domain\Repository\SiteRepository;
use Neos\Neos\Domain\Service\WorkspaceNameBuilder;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
use Neos\Neos\Service\BackendRedirectionService;
use Neos\Neos\Service\UserService;
use Neos\Flow\Persistence\PersistenceManagerInterface;
use Neos\Fusion\View\FusionView;
use Neos\Flow\Mvc\View\ViewInterface;
use Neos\Neos\Ui\Domain\Service\StyleAndJavascriptInclusionService;
use Neos\Neos\Ui\Service\NodeClipboard;

Expand Down Expand Up @@ -148,8 +148,7 @@ public function indexAction(string $node = null)

$currentAccount = $this->securityContext->getAccount();
$workspace = $contentRepository->getWorkspaceFinder()->findOneByName(
NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
->toContentRepositoryWorkspaceName()
WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier())
);
if (is_null($workspace)) {
$this->redirectToUri($this->uriBuilder->uriFor('index', [], 'Login', 'Neos.Neos'));
Expand Down
26 changes: 11 additions & 15 deletions Classes/Controller/BackendServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
* source code.
*/

use Neos\ContentRepository\Core\Feature\WorkspaceModification\Command\ChangeBaseWorkspace;
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Exception\WorkspaceIsNotEmptyException;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Command\DiscardIndividualNodesFromWorkspace;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Command\PublishIndividualNodesFromWorkspace;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdsToPublishOrDiscard;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdToPublishOrDiscard;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeAggregateCurrentlyDoesNotExist;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Eel\FlowQuery\FlowQuery;
use Neos\Flow\Annotations as Flow;
Expand All @@ -29,7 +32,7 @@
use Neos\Flow\Persistence\PersistenceManagerInterface;
use Neos\Flow\Property\PropertyMapper;
use Neos\Flow\Security\Context;
use Neos\Neos\Domain\Model\WorkspaceName as NeosWorkspaceName;
use Neos\Neos\Domain\Service\WorkspaceNameBuilder;
use Neos\Neos\FrontendRouting\NodeAddress;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
Expand All @@ -40,6 +43,8 @@
use Neos\Neos\Ui\Domain\Model\Feedback\Messages\Error;
use Neos\Neos\Ui\Domain\Model\Feedback\Messages\Info;
use Neos\Neos\Ui\Domain\Model\Feedback\Messages\Success;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\Redirect;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\ReloadDocument;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\UpdateWorkspaceInfo;
use Neos\Neos\Ui\Domain\Model\FeedbackCollection;
use Neos\Neos\Ui\Domain\Service\NodeTreeBuilder;
Expand All @@ -50,12 +55,6 @@
use Neos\Neos\Ui\Service\PublishingService;
use Neos\Neos\Ui\TypeConverter\ChangeCollectionConverter;
use Neos\Neos\Utility\NodeUriPathSegmentGenerator;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Command\ChangeBaseWorkspace;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\ReloadDocument;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\Redirect;
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Exception\WorkspaceIsNotEmptyException;

class BackendServiceController extends ActionController
{
Expand Down Expand Up @@ -195,8 +194,7 @@ public function publishAllAction(): void
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);

$currentAccount = $this->securityContext->getAccount();
$workspaceName = NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
->toContentRepositoryWorkspaceName();
$workspaceName = WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier());
$this->publishingService->publishWorkspace($contentRepository, $workspaceName);

$success = new Success();
Expand All @@ -222,8 +220,7 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa

try {
$currentAccount = $this->securityContext->getAccount();
$workspaceName = NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
->toContentRepositoryWorkspaceName();
$workspaceName = WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier());

$nodeIdentifiersToPublish = [];
foreach ($nodeContextPaths as $contextPath) {
Expand Down Expand Up @@ -282,8 +279,7 @@ public function discardAction(array $nodeContextPaths): void

try {
$currentAccount = $this->securityContext->getAccount();
$workspaceName = NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
->toContentRepositoryWorkspaceName();
$workspaceName = WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier());

$nodeIdentifiersToDiscard = [];
foreach ($nodeContextPaths as $contextPath) {
Expand Down Expand Up @@ -343,9 +339,9 @@ public function changeBaseWorkspaceAction(string $targetWorkspaceName, string $d
$nodeAddress = $nodeAddressFactory->createFromUriString($documentNode);

$currentAccount = $this->securityContext->getAccount();
$userWorkspaceName = NeosWorkspaceName::fromAccountIdentifier(
$userWorkspaceName = WorkspaceNameBuilder::fromAccountIdentifier(
$currentAccount->getAccountIdentifier()
)->toContentRepositoryWorkspaceName();
);

$command = ChangeBaseWorkspace::create($userWorkspaceName, WorkspaceName::fromString($targetWorkspaceName));
try {
Expand Down
11 changes: 4 additions & 7 deletions Classes/Fusion/Helper/WorkspaceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
* source code.
*/

use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\ContentRepository\Core\Factory\ContentRepositoryId;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Eel\ProtectedContextAwareInterface;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\Neos\Domain\Model\WorkspaceName as NeosWorkspaceName;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Security\Context;
use Neos\Neos\Domain\Service\UserService as DomainUserService;
use Neos\Flow\Annotations as Flow;
use Neos\Neos\Domain\Service\WorkspaceNameBuilder;
use Neos\Neos\Ui\ContentRepository\Service\WorkspaceService;

/**
Expand Down Expand Up @@ -63,9 +62,7 @@ public function getPersonalWorkspace(ContentRepositoryId $contentRepositoryId):
{
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
$currentAccount = $this->securityContext->getAccount();
$personalWorkspaceName = NeosWorkspaceName::fromAccountIdentifier(
$currentAccount->getAccountIdentifier()
)->toContentRepositoryWorkspaceName();
$personalWorkspaceName = WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier());
$personalWorkspace = $contentRepository->getWorkspaceFinder()->findOneByName($personalWorkspaceName);

return !is_null($personalWorkspace)
Expand Down