Skip to content

Commit

Permalink
Merge pull request #4675 from neos/siblingReordering
Browse files Browse the repository at this point in the history
Sort siblings before reassigning positions
  • Loading branch information
nezaniel authored Nov 1, 2023
2 parents 0e4e210 + 7e2a09c commit 5df5430
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,6 @@ private function connectHierarchy(
}

/**
* @param NodeRelationAnchorPoint|null $parentAnchorPoint
* @param NodeRelationAnchorPoint|null $childAnchorPoint
* @param NodeRelationAnchorPoint|null $succeedingSiblingAnchorPoint
* @param ContentStreamId $contentStreamId
* @param DimensionSpacePoint $dimensionSpacePoint
* @return int
* @throws \Doctrine\DBAL\DBALException
*/
private function getRelationPosition(
Expand Down Expand Up @@ -590,6 +584,12 @@ private function getRelationPositionAfterRecalculation(
$dimensionSpacePoint
);

usort(
$hierarchyRelations,
fn (HierarchyRelation $relationA, HierarchyRelation $relationB): int
=> $relationA->position <=> $relationB->position
);

foreach ($hierarchyRelations as $relation) {
$offset += self::RELATION_DEFAULT_OFFSET;
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ private function whenNodeAggregateWasMoved(NodeAggregateWasMoved $event): void
$this->transactional(function () use ($event) {
foreach ($event->nodeMoveMappings as $moveNodeMapping) {
// for each materialized node in the DB which we want to adjust, we have one MoveNodeMapping.
/* @var \Neos\ContentRepository\Core\Feature\NodeMove\Dto\OriginNodeMoveMapping $moveNodeMapping */
$nodeToBeMoved = $this->getProjectionContentGraph()->findNodeByIds(
$event->contentStreamId,
$event->nodeAggregateId,
Expand Down

Large diffs are not rendered by default.

0 comments on commit 5df5430

Please sign in to comment.