Skip to content

Commit

Permalink
WIP: Simplify publishing, that partial and full publish is the same
Browse files Browse the repository at this point in the history
reasoning:

- the `publishedNodeIds` were removed on the event, as we dont need it, and it would rise a discussion if we need to keep dimension space points there too or not: see neos/neos-development-collection#5386 how i archived it.

- instead of now trying to make `WorkspaceWasPartiallyPublished` contain all the information we dont use or need, the idea is to make it dumb. Now its basically just a `WorkspaceWasPublished` and then the other remaining events are applied as if they were carried out by a user.
If we need to add more metadata to the partial publish at some point, that would need a new event id say as we woouldnt be able to mess with the `WorkspaceWasPartiallyPublished` once released.
So by just combining them into one we have the option open to create a `WorkspaceWasPartiallyPublished` again but differently which wil be breaking too but differently. Its just a new event then, no need to migrate data.
  • Loading branch information
mhsdesign committed Nov 30, 2024
1 parent 5d7fecb commit 64c6e6e
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 150 deletions.
4 changes: 0 additions & 4 deletions Classes/EventStore/EventNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Event\WorkspaceWasRemoved;
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Event\WorkspaceWasRenamed;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasDiscarded;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPartiallyDiscarded;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPartiallyPublished;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPublished;
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Event\WorkspaceRebaseFailed;
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Event\WorkspaceWasRebased;
Expand Down Expand Up @@ -102,8 +100,6 @@ public function __construct()
WorkspaceWasCreated::class,
WorkspaceWasRenamed::class,
WorkspaceWasDiscarded::class,
WorkspaceWasPartiallyDiscarded::class,
WorkspaceWasPartiallyPublished::class,
WorkspaceWasPublished::class,
WorkspaceWasRebased::class,
WorkspaceWasRemoved::class,
Expand Down
6 changes: 2 additions & 4 deletions Classes/Feature/WorkspaceCommandHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Command\PublishIndividualNodesFromWorkspace;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Command\PublishWorkspace;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasDiscarded;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPartiallyDiscarded;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPartiallyPublished;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPublished;
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Command\RebaseWorkspace;
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Dto\RebaseErrorHandlingStrategy;
Expand Down Expand Up @@ -539,7 +537,7 @@ static function ($handle) use ($commandSimulator, $matchingCommands, $remainingC
new EventsToPublish(
WorkspaceEventStreamName::fromWorkspaceName($command->workspaceName)->getEventStreamName(),
Events::fromArray([
new WorkspaceWasPartiallyPublished(
new WorkspaceWasPublished(
$command->workspaceName,
$baseWorkspace->workspaceName,
$command->contentStreamIdForRemainingPart,
Expand Down Expand Up @@ -639,7 +637,7 @@ static function ($handle) use ($commandsToKeep): void {
new EventsToPublish(
WorkspaceEventStreamName::fromWorkspaceName($command->workspaceName)->getEventStreamName(),
Events::with(
new WorkspaceWasPartiallyDiscarded(
new WorkspaceWasDiscarded(
$command->workspaceName,
$command->newContentStreamId,
$workspace->currentContentStreamId,
Expand Down

This file was deleted.

This file was deleted.

24 changes: 0 additions & 24 deletions Classes/Service/ContentStreamPruner.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
use Neos\ContentRepository\Core\Feature\WorkspaceCreation\Event\WorkspaceWasCreated;
use Neos\ContentRepository\Core\Feature\WorkspaceEventStreamName;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasDiscarded;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPartiallyDiscarded;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPartiallyPublished;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPublished;
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Event\WorkspaceRebaseFailed;
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Event\WorkspaceWasRebased;
Expand Down Expand Up @@ -323,8 +321,6 @@ private function findAllContentStreams(): array
EventType::fromString('RootWorkspaceWasCreated'),
EventType::fromString('WorkspaceWasCreated'),
EventType::fromString('WorkspaceWasDiscarded'),
EventType::fromString('WorkspaceWasPartiallyDiscarded'),
EventType::fromString('WorkspaceWasPartiallyPublished'),
EventType::fromString('WorkspaceWasPublished'),
EventType::fromString('WorkspaceWasRebased'),
EventType::fromString('WorkspaceRebaseFailed'),
Expand Down Expand Up @@ -358,26 +354,6 @@ private function findAllContentStreams(): array
->withStatus(ContentStreamStatus::NO_LONGER_IN_USE);
}
break;
case WorkspaceWasPartiallyDiscarded::class:
if (isset($cs[$domainEvent->newContentStreamId->value])) {
$cs[$domainEvent->newContentStreamId->value] = $cs[$domainEvent->newContentStreamId->value]
->withStatus(ContentStreamStatus::IN_USE_BY_WORKSPACE);
}
if (isset($cs[$domainEvent->previousContentStreamId->value])) {
$cs[$domainEvent->previousContentStreamId->value] = $cs[$domainEvent->previousContentStreamId->value]
->withStatus(ContentStreamStatus::NO_LONGER_IN_USE);
}
break;
case WorkspaceWasPartiallyPublished::class:
if (isset($cs[$domainEvent->newSourceContentStreamId->value])) {
$cs[$domainEvent->newSourceContentStreamId->value] = $cs[$domainEvent->newSourceContentStreamId->value]
->withStatus(ContentStreamStatus::IN_USE_BY_WORKSPACE);
}
if (isset($cs[$domainEvent->previousSourceContentStreamId->value])) {
$cs[$domainEvent->previousSourceContentStreamId->value] = $cs[$domainEvent->previousSourceContentStreamId->value]
->withStatus(ContentStreamStatus::NO_LONGER_IN_USE);
}
break;
case WorkspaceWasPublished::class:
if (isset($cs[$domainEvent->newSourceContentStreamId->value])) {
$cs[$domainEvent->newSourceContentStreamId->value] = $cs[$domainEvent->newSourceContentStreamId->value]
Expand Down

0 comments on commit 64c6e6e

Please sign in to comment.