diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W10-IndividualNodeDiscarding/02-BasicFeatures.feature b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W10-IndividualNodeDiscarding/02-BasicFeatures.feature index ba09c5aceb..fa81a2fc56 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W10-IndividualNodeDiscarding/02-BasicFeatures.feature +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W10-IndividualNodeDiscarding/02-BasicFeatures.feature @@ -100,6 +100,13 @@ Feature: Discard individual nodes (basics) | newContentStreamId | "user-cs-identifier-new" | Then I expect the content stream "user-cs-identifier" to not exist + Then I expect exactly 2 events to be published on stream with prefix "Workspace:user-test" + And event at index 1 is of type "WorkspaceWasDiscarded" with payload: + | Key | Expected | + | workspaceName | "user-test" | + | newContentStreamId | "user-cs-identifier-new" | + | previousContentStreamId | "user-cs-identifier" | + When I am in workspace "user-test" and dimension space point {} Then I expect node aggregate identifier "sir-david-nodenborough" to lead to node user-cs-identifier-new;sir-david-nodenborough;{} And I expect this node to have the following properties: @@ -159,7 +166,6 @@ Feature: Discard individual nodes (basics) | nodesToDiscard | ["sir-david-nodenborough", "nody-mc-nodeface", "sir-nodeward-nodington-iii"] | | newContentStreamId | "user-cs-identifier-new" | - # when discarding all nodes we expect a full discard via WorkspaceWasDiscarded Then I expect exactly 2 events to be published on stream with prefix "Workspace:user-test" And event at index 1 is of type "WorkspaceWasDiscarded" with payload: | Key | Expected | diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/02-BasicFeatures.feature b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/02-BasicFeatures.feature index f9450d4ea0..befd11ea2f 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/02-BasicFeatures.feature +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/02-BasicFeatures.feature @@ -57,6 +57,14 @@ Feature: Individual node publication | nodesToPublish | ["sir-david-nodenborough"] | | contentStreamIdForRemainingPart | "user-cs-identifier-remaining" | + Then I expect exactly 2 events to be published on stream with prefix "Workspace:user-test" + And event at index 1 is of type "WorkspaceWasPublished" with payload: + | Key | Expected | + | sourceWorkspaceName | "user-test" | + | targetWorkspaceName | "live" | + | newSourceContentStreamId | "user-cs-identifier-remaining" | + | previousSourceContentStreamId | "user-cs-identifier" | + And I am in workspace "live" Then I expect a node identified by cs-identifier;sir-david-nodenborough;{} to exist in the content graph diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/03-MoreBasicFeatures.feature b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/03-MoreBasicFeatures.feature index b1cca28db8..6935df0457 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/03-MoreBasicFeatures.feature +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/03-MoreBasicFeatures.feature @@ -211,7 +211,6 @@ Feature: Publishing individual nodes (basics) | nodesToPublish | ["sir-david-nodenborough", "nody-mc-nodeface", "sir-nodeward-nodington-iii"] | | contentStreamIdForRemainingPart | "user-cs-identifier-remaining" | - # when publishing all nodes we expect a full discard via WorkspaceWasPublished Then I expect exactly 2 events to be published on stream with prefix "Workspace:user-test" And event at index 1 is of type "WorkspaceWasPublished" with payload: | Key | Expected | diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php index b499fbecf0..f9dae23bde 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php @@ -209,26 +209,6 @@ private function handlePublishWorkspace( $workspaceContentStreamVersion ); - yield from $this->publishWorkspace( - $workspace, - $baseWorkspace, - $baseWorkspaceContentStreamVersion, - $command->newContentStreamId, - $rebaseableCommands - ); - } - - /** - * Note that the workspaces content stream must be closed beforehand. - * It will be reopened here in case of error. - */ - private function publishWorkspace( - Workspace $workspace, - Workspace $baseWorkspace, - Version $baseWorkspaceContentStreamVersion, - ContentStreamId $newContentStreamId, - RebaseableCommands $rebaseableCommands - ): \Generator { $commandSimulator = $this->commandSimulatorFactory->createSimulatorForWorkspace($baseWorkspace->workspaceName); $commandSimulator->run( @@ -267,7 +247,7 @@ static function ($handle) use ($rebaseableCommands): void { } yield $this->forkContentStream( - $newContentStreamId, + $command->newContentStreamId, $baseWorkspace->currentContentStreamId, Version::fromInteger($baseWorkspaceContentStreamVersion->value + $eventsOfWorkspaceToPublish->count()) ); @@ -278,7 +258,7 @@ static function ($handle) use ($rebaseableCommands): void { new WorkspaceWasPublished( $workspace->workspaceName, $baseWorkspace->workspaceName, - $newContentStreamId, + $command->newContentStreamId, $workspace->currentContentStreamId, ) ), @@ -475,18 +455,6 @@ private function handlePublishIndividualNodesFromWorkspace( $workspaceContentStreamVersion ); - if ($remainingCommands->isEmpty()) { - // do a full publish, this is simpler for the projections to handle - yield from $this->publishWorkspace( - $workspace, - $baseWorkspace, - $baseWorkspaceContentStreamVersion, - $command->contentStreamIdForRemainingPart, - $matchingCommands - ); - return; - } - $commandSimulator = $this->commandSimulatorFactory->createSimulatorForWorkspace($baseWorkspace->workspaceName); $highestSequenceNumberForMatching = $commandSimulator->run(