Skip to content

Commit

Permalink
Merge branch 'feature/4726-extract-workspace-metadata-and-user-assign…
Browse files Browse the repository at this point in the history
…ment-to-neos' of https://github.com/neos/neos-ui into feature/4726-extract-workspace-metadata-and-user-assignment-to-neos
  • Loading branch information
bwaidelich committed Oct 1, 2024
2 parents 8a2445e + 71f8981 commit c875879
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#[Flow\Scope("singleton")]
final class ReloadNodesQueryHandler
{

#[Flow\Inject]
protected ContentRepositoryRegistry $contentRepositoryRegistry;

Expand Down
62 changes: 43 additions & 19 deletions Classes/Controller/BackendServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
use Neos\Neos\Service\UserService;
use Neos\Neos\Ui\Application\ChangeTargetWorkspace;
use Neos\Neos\Ui\Application\DiscardAllChanges;
use Neos\Neos\Ui\Application\DiscardChangesInDocument;
use Neos\Neos\Ui\Application\DiscardChangesInSite;
use Neos\Neos\Ui\Application\PublishChangesInDocument;
use Neos\Neos\Ui\Application\PublishChangesInSite;
use Neos\Neos\Ui\Application\ReloadNodes\ReloadNodesQuery;
use Neos\Neos\Ui\Application\ReloadNodes\ReloadNodesQueryHandler;
use Neos\Neos\Ui\Application\SyncWorkspace\ConflictsOccurred;
Expand Down Expand Up @@ -201,14 +206,16 @@ public function publishChangesInSiteAction(array $command): void
try {
/** @todo send from UI */
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())->contentRepositoryId;
$siteNodeAddress = $this->nodeService->deserializeNodeAddress(
$command['contentRepositoryId'] = $contentRepositoryId->value;
$command['siteId'] = $this->nodeService->deserializeNodeAddress(
$command['siteId'],
$contentRepositoryId
);
)->nodeAggregateId->value;
$command = PublishChangesInSite::fromArray($command);
$publishingResult = $this->workspacePublishingService->publishChangesInSite(
$contentRepositoryId,
$siteNodeAddress->workspaceName,
$siteNodeAddress->nodeAggregateId,
$command->contentRepositoryId,
$command->workspaceName,
$command->siteId,
);
$this->view->assign('value', [
'success' => [
Expand Down Expand Up @@ -238,15 +245,18 @@ public function publishChangesInDocumentAction(array $command): void
try {
/** @todo send from UI */
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())->contentRepositoryId;
$documentNodeAddress = $this->nodeService->deserializeNodeAddress(
$command['contentRepositoryId'] = $contentRepositoryId->value;
$command['documentId'] = $this->nodeService->deserializeNodeAddress(
$command['documentId'],
$contentRepositoryId
);
)->nodeAggregateId->value;
$command = PublishChangesInDocument::fromArray($command);

try {
$publishingResult = $this->workspacePublishingService->publishChangesInDocument(
$contentRepositoryId,
$documentNodeAddress->workspaceName,
$documentNodeAddress->nodeAggregateId,
$command->contentRepositoryId,
$command->workspaceName,
$command->documentId,
);

$this->view->assign('value', [
Expand Down Expand Up @@ -290,9 +300,14 @@ public function discardAllChangesAction(array $command): void
try {
/** @todo send from UI */
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())->contentRepositoryId;
$workspaceName = WorkspaceName::fromString($command['workspaceName']);
$command['contentRepositoryId'] = $contentRepositoryId->value;
$command = DiscardAllChanges::fromArray($command);

$discardingResult = $this->workspacePublishingService->discardAllWorkspaceChanges(
$command->contentRepositoryId,
$command->workspaceName
);

$discardingResult = $this->workspacePublishingService->discardAllWorkspaceChanges($contentRepositoryId, $workspaceName);
$this->view->assign('value', [
'success' => [
'numberOfAffectedChanges' => $discardingResult->numberOfDiscardedChanges
Expand Down Expand Up @@ -320,15 +335,17 @@ public function discardChangesInSiteAction(array $command): void
try {
/** @todo send from UI */
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())->contentRepositoryId;
$siteNodeAddress = $this->nodeService->deserializeNodeAddress(
$command['contentRepositoryId'] = $contentRepositoryId->value;
$command['siteId'] = $this->nodeService->deserializeNodeAddress(
$command['siteId'],
$contentRepositoryId
);
)->nodeAggregateId->value;
$command = DiscardChangesInSite::fromArray($command);

$discardingResult = $this->workspacePublishingService->discardChangesInSite(
$contentRepositoryId,
$siteNodeAddress->workspaceName,
$siteNodeAddress->nodeAggregateId
$command->contentRepositoryId,
$command->workspaceName,
$command->siteId
);

$this->view->assign('value', [
Expand Down Expand Up @@ -358,11 +375,18 @@ public function discardChangesInDocumentAction(array $command): void
try {
/** @todo send from UI */
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())->contentRepositoryId;
$documentNodeAddress = $this->nodeService->deserializeNodeAddress(
$command['contentRepositoryId'] = $contentRepositoryId->value;
$command['documentId'] = $this->nodeService->deserializeNodeAddress(
$command['documentId'],
$contentRepositoryId
)->nodeAggregateId->value;
$command = DiscardChangesInDocument::fromArray($command);

$discardingResult = $this->workspacePublishingService->discardChangesInDocument(
$command->contentRepositoryId,
$command->workspaceName,
$command->documentId
);
$discardingResult = $this->workspacePublishingService->discardChangesInDocument($contentRepositoryId, $documentNodeAddress->workspaceName, $documentNodeAddress->nodeAggregateId);

$this->view->assign('value', [
'success' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public function getConfiguration(
];
}

/**
* @return array<string,array{name:string,title:string,readonly:bool}>
*/
private function getAllowedTargetWorkspaces(ContentRepository $contentRepository): array
{
$backendUser = $this->userService->getBackendUser();
Expand Down

0 comments on commit c875879

Please sign in to comment.