Skip to content

Commit 554879b

Browse files
committed
Merge remote-tracking branch 'origin/9.0' into feature/improveNodeCreationHandlerInterface
2 parents d4c0bf5 + 1d9df94 commit 554879b

File tree

16 files changed

+145
-54
lines changed

16 files changed

+145
-54
lines changed

Classes/ContentRepository/Service/WorkspaceService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ public function predictRemoveNodeFeedbackFromDiscardIndividualNodesFromWorkspace
179179
}
180180

181181
if (
182-
$nodeToDiscard->contentStreamId->equals($change->contentStreamId)
182+
$nodeToDiscard->workspaceName->equals($workspace->workspaceName)
183183
&& $nodeToDiscard->nodeAggregateId->equals($change->nodeAggregateId)
184184
&& $nodeToDiscard->dimensionSpacePoint->equals($change->originDimensionSpacePoint)
185185
) {
186186
$subgraph = $contentRepository->getContentGraph()
187187
->getSubgraph(
188-
$nodeToDiscard->contentStreamId,
188+
$workspace->currentContentStreamId,
189189
$nodeToDiscard->dimensionSpacePoint,
190190
VisibilityConstraints::withoutRestrictions()
191191
);

Classes/Controller/BackendServiceController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa
221221
foreach ($nodeContextPaths as $contextPath) {
222222
$nodeAddress = $nodeAddressFactory->createFromUriString($contextPath);
223223
$nodeIdentifiersToPublish[] = new NodeIdToPublishOrDiscard(
224-
$nodeAddress->contentStreamId,
224+
$workspaceName,
225225
$nodeAddress->nodeAggregateId,
226226
$nodeAddress->dimensionSpacePoint
227227
);
@@ -279,7 +279,7 @@ public function discardAction(array $nodeContextPaths): void
279279
foreach ($nodeContextPaths as $contextPath) {
280280
$nodeAddress = $nodeAddressFactory->createFromUriString($contextPath);
281281
$nodeIdentifiersToDiscard[] = new NodeIdToPublishOrDiscard(
282-
$nodeAddress->contentStreamId,
282+
$workspaceName,
283283
$nodeAddress->nodeAggregateId,
284284
$nodeAddress->dimensionSpacePoint
285285
);

Classes/Domain/Model/Changes/AbstractCreate.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,24 @@ protected function createNode(
140140

141141
$nodeAggregateId = $this->getNodeAggregateId() ?? NodeAggregateId::create(); // generate a new NodeAggregateId
142142

143+
$contentRepository = $this->contentRepositoryRegistry->get($parentNode->subgraphIdentity->contentRepositoryId);
144+
$workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId)
145+
->getWorkspaceFinder()->findOneByCurrentContentStreamId($parentNode->subgraphIdentity->contentStreamId);
146+
if (!$workspace) {
147+
throw new \Exception(
148+
'Could not find workspace for content stream "' . $parentNode->subgraphIdentity->contentStreamId->value . '"',
149+
1699008140
150+
);
151+
}
143152
$command = CreateNodeAggregateWithNode::create(
144-
$parentNode->subgraphIdentity->contentStreamId,
153+
$workspace->workspaceName,
145154
$nodeAggregateId,
146155
$nodeTypeName,
147156
OriginDimensionSpacePoint::fromDimensionSpacePoint($parentNode->subgraphIdentity->dimensionSpacePoint),
148157
$parentNode->nodeAggregateId,
149158
$succeedingSiblingNodeAggregateId,
150159
$nodeName
151160
);
152-
$contentRepository = $this->contentRepositoryRegistry->get($parentNode->subgraphIdentity->contentRepositoryId);
153161

154162
$commands = $this->applyNodeCreationHandlers(
155163
NodeCreationCommands::fromFirstCommand(

Classes/Domain/Model/Changes/CopyAfter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,17 @@ public function apply(): void
7171
$targetNodeName = NodeName::fromString(uniqid('node-'));
7272

7373
$contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId);
74+
$workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId);
75+
if (!$workspace) {
76+
throw new \Exception('Could not find workspace for content stream', 1699004343);
77+
}
7478
$command = CopyNodesRecursively::createFromSubgraphAndStartNode(
7579
$contentRepository->getContentGraph()->getSubgraph(
7680
$subject->subgraphIdentity->contentStreamId,
7781
$subject->subgraphIdentity->dimensionSpacePoint,
7882
VisibilityConstraints::withoutRestrictions()
7983
),
84+
$workspace->workspaceName,
8085
$subject,
8186
OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->subgraphIdentity->dimensionSpacePoint),
8287
$parentNodeOfPreviousSibling->nodeAggregateId,

Classes/Domain/Model/Changes/CopyBefore.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,17 @@ public function apply(): void
6464
$targetNodeName = NodeName::fromString(uniqid('node-'));
6565

6666
$contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId);
67+
$workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId);
68+
if (!$workspace) {
69+
throw new \Exception('Could not find workspace for content stream', 1699004343);
70+
}
6771
$command = CopyNodesRecursively::createFromSubgraphAndStartNode(
6872
$contentRepository->getContentGraph()->getSubgraph(
6973
$subject->subgraphIdentity->contentStreamId,
7074
$subject->subgraphIdentity->dimensionSpacePoint,
7175
$subject->subgraphIdentity->visibilityConstraints
7276
),
77+
$workspace->workspaceName,
7378
$subject,
7479
OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->subgraphIdentity->dimensionSpacePoint),
7580
$parentNodeOfSucceedingSibling->nodeAggregateId,

Classes/Domain/Model/Changes/CopyInto.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,17 @@ public function apply(): void
7272
$targetNodeName = NodeName::fromString(uniqid('node-'));
7373

7474
$contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId);
75+
$workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId);
76+
if (!$workspace) {
77+
throw new \Exception('Could not find workspace for content stream', 1699004343);
78+
}
7579
$command = CopyNodesRecursively::createFromSubgraphAndStartNode(
7680
$contentRepository->getContentGraph()->getSubgraph(
7781
$subject->subgraphIdentity->contentStreamId,
7882
$subject->subgraphIdentity->dimensionSpacePoint,
7983
$subject->subgraphIdentity->visibilityConstraints
8084
),
85+
$workspace->workspaceName,
8186
$subject,
8287
OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->subgraphIdentity->dimensionSpacePoint),
8388
$parentNode->nodeAggregateId,

Classes/Domain/Model/Changes/MoveAfter.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,26 @@ public function apply(): void
7676
$hasEqualParentNode = $parentNode->nodeAggregateId
7777
->equals($parentNodeOfPreviousSibling->nodeAggregateId);
7878

79+
80+
$contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId);
81+
$workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId)
82+
->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId);
83+
if (!$workspace) {
84+
throw new \Exception(
85+
'Could not find workspace for content stream "' . $subject->subgraphIdentity->contentStreamId->value . '"',
86+
1699008140
87+
);
88+
}
89+
7990
$command = MoveNodeAggregate::create(
80-
$subject->subgraphIdentity->contentStreamId,
91+
$workspace->workspaceName,
8192
$subject->subgraphIdentity->dimensionSpacePoint,
8293
$subject->nodeAggregateId,
8394
RelationDistributionStrategy::STRATEGY_GATHER_ALL,
8495
$hasEqualParentNode ? null : $parentNodeOfPreviousSibling->nodeAggregateId,
8596
$precedingSibling->nodeAggregateId,
8697
$succeedingSibling?->nodeAggregateId,
8798
);
88-
89-
$contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId);
9099
$contentRepository->handle($command)->block();
91100

92101
$updateParentNodeInfo = new UpdateNodeInfo();

Classes/Domain/Model/Changes/MoveBefore.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,18 @@ public function apply(): void
7272
->equals($succeedingSiblingParent->nodeAggregateId);
7373

7474
$contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId);
75+
$workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId)
76+
->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId);
77+
if (!$workspace) {
78+
throw new \Exception(
79+
'Could not find workspace for content stream "' . $subject->subgraphIdentity->contentStreamId->value . '"',
80+
1699008140
81+
);
82+
}
7583

7684
$contentRepository->handle(
7785
MoveNodeAggregate::create(
78-
$subject->subgraphIdentity->contentStreamId,
86+
$workspace->workspaceName,
7987
$subject->subgraphIdentity->dimensionSpacePoint,
8088
$subject->nodeAggregateId,
8189
RelationDistributionStrategy::STRATEGY_GATHER_ALL,

Classes/Domain/Model/Changes/MoveInto.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Neos\ContentRepository\Core\Feature\NodeMove\Command\MoveNodeAggregate;
1616
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
1717
use Neos\ContentRepository\Core\Feature\NodeMove\Dto\RelationDistributionStrategy;
18-
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\RemoveNode;
1918
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\UpdateNodeInfo;
2019

2120
/**
@@ -84,9 +83,17 @@ public function apply(): void
8483
->equals($parentNode->nodeAggregateId);
8584

8685
$contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId);
86+
$workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId)
87+
->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId);
88+
if (!$workspace) {
89+
throw new \Exception(
90+
'Could not find workspace for content stream "' . $subject->subgraphIdentity->contentStreamId->value . '"',
91+
1699008140
92+
);
93+
}
8794
$contentRepository->handle(
8895
MoveNodeAggregate::create(
89-
$subject->subgraphIdentity->contentStreamId,
96+
$workspace->workspaceName,
9097
$subject->subgraphIdentity->dimensionSpacePoint,
9198
$subject->nodeAggregateId,
9299
RelationDistributionStrategy::STRATEGY_GATHER_ALL,

Classes/Domain/Model/Changes/Property.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
use Neos\Neos\Ui\Domain\Service\NodePropertyConversionService;
3939
use Neos\Neos\Utility\NodeTypeWithFallbackProvider;
4040

41-
/** @codingStandardsIgnoreStart */
42-
/** @codingStandardsIgnoreEnd */
43-
4441
/**
4542
* Changes a property on a node
4643
* @internal These objects internally reflect possible operations made by the Neos.Ui.
@@ -158,6 +155,15 @@ public function apply(): void
158155

159156
$propertyType = $this->getNodeType($subject)->getPropertyType($propertyName);
160157

158+
$workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId)
159+
->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId);
160+
if (!$workspace) {
161+
throw new \Exception(
162+
'Could not find workspace for content stream "' . $subject->subgraphIdentity->contentStreamId->value . '"',
163+
1699008140
164+
);
165+
}
166+
161167
// Use extra commands for reference handling
162168
if ($propertyType === 'reference' || $propertyType === 'references') {
163169
$value = $this->getValue();
@@ -180,7 +186,7 @@ public function apply(): void
180186

181187
$commandResult = $contentRepository->handle(
182188
SetNodeReferences::create(
183-
$subject->subgraphIdentity->contentStreamId,
189+
$workspace->workspaceName,
184190
$subject->nodeAggregateId,
185191
$subject->originDimensionSpacePoint,
186192
ReferenceName::fromString($propertyName),
@@ -200,7 +206,7 @@ public function apply(): void
200206
// if origin dimension space point != current DSP -> translate transparently (matching old behavior)
201207
$contentRepository->handle(
202208
CreateNodeVariant::create(
203-
$subject->subgraphIdentity->contentStreamId,
209+
$workspace->workspaceName,
204210
$subject->nodeAggregateId,
205211
$subject->originDimensionSpacePoint,
206212
$originDimensionSpacePoint
@@ -209,7 +215,7 @@ public function apply(): void
209215
}
210216
$commandResult = $contentRepository->handle(
211217
SetNodeProperties::create(
212-
$subject->subgraphIdentity->contentStreamId,
218+
$workspace->workspaceName,
213219
$subject->nodeAggregateId,
214220
$originDimensionSpacePoint,
215221
PropertyValuesToWrite::fromArray(
@@ -224,7 +230,7 @@ public function apply(): void
224230
if ($propertyName === '_nodeType') {
225231
$commandResult = $contentRepository->handle(
226232
ChangeNodeAggregateType::create(
227-
$subject->subgraphIdentity->contentStreamId,
233+
$workspace->workspaceName,
228234
$subject->nodeAggregateId,
229235
NodeTypeName::fromString($value),
230236
NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy::STRATEGY_DELETE
@@ -234,7 +240,7 @@ public function apply(): void
234240
if ($value === true) {
235241
$commandResult = $contentRepository->handle(
236242
DisableNodeAggregate::create(
237-
$subject->subgraphIdentity->contentStreamId,
243+
$workspace->workspaceName,
238244
$subject->nodeAggregateId,
239245
$subject->originDimensionSpacePoint->toDimensionSpacePoint(),
240246
NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS
@@ -244,7 +250,7 @@ public function apply(): void
244250
// unhide
245251
$commandResult = $contentRepository->handle(
246252
EnableNodeAggregate::create(
247-
$subject->subgraphIdentity->contentStreamId,
253+
$workspace->workspaceName,
248254
$subject->nodeAggregateId,
249255
$subject->originDimensionSpacePoint->toDimensionSpacePoint(),
250256
NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS

Classes/Domain/Model/Changes/Remove.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,16 @@ public function apply(): void
7474

7575
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($this->subject);
7676
$closestDocumentParentNode = $subgraph->findClosestNode($this->subject->nodeAggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT));
77+
$workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId)
78+
->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId);
79+
if (!$workspace) {
80+
throw new \Exception(
81+
'Could not find workspace for content stream "' . $subject->subgraphIdentity->contentStreamId->value . '"',
82+
1699008140
83+
);
84+
}
7785
$command = RemoveNodeAggregate::create(
78-
$subject->subgraphIdentity->contentStreamId,
86+
$workspace->workspaceName,
7987
$subject->nodeAggregateId,
8088
$subject->subgraphIdentity->dimensionSpacePoint,
8189
NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS,
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React, {PureComponent} from 'react';
2+
import PropTypes from 'prop-types';
3+
import {connect} from 'react-redux';
4+
5+
import style from './style.module.css';
6+
7+
@connect(state => ({
8+
userFirstName: state?.user?.name?.firstName,
9+
userLastName: state?.user?.name?.lastName
10+
}))
11+
12+
export default class UserImage extends PureComponent {
13+
static propTypes = {
14+
userFirstName: PropTypes.string,
15+
userLastName: PropTypes.string
16+
};
17+
18+
render() {
19+
const userInitials = this.props.userFirstName?.charAt(0) + this.props.userLastName?.charAt(0);
20+
return (
21+
<div className={style.user__image}>{userInitials}</div>
22+
);
23+
}
24+
}

packages/neos-ui/src/Containers/PrimaryToolbar/UserDropDown/index.js renamed to packages/neos-ui/src/Containers/Drawer/UserDropDown/index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {connect} from 'react-redux';
44

55
import {neos} from '@neos-project/neos-ui-decorators';
66
import {Icon, DropDown} from '@neos-project/react-ui-components';
7+
import UserImage from './UserImage';
78
import RestoreButtonItem from './RestoreButtonItem';
89

910
import I18n from '@neos-project/neos-ui-i18n';
@@ -28,10 +29,16 @@ export default class UserDropDown extends PureComponent {
2829
<div className={style.wrapper}>
2930
<DropDown className={style.dropDown}>
3031
<DropDown.Header className={style.dropDown__btn}>
31-
<Icon className={style.dropDown__btnIcon} icon="user"/>
32+
<UserImage />
3233
<span className={style.dropDown__userName}>{this.props.userName}</span>
3334
</DropDown.Header>
3435
<DropDown.Contents className={style.dropDown__contents}>
36+
<li className={style.dropDown__item}>
37+
<a title="User Settings" href={userSettingsUri}>
38+
<Icon icon="wrench" aria-hidden="true" className={style.dropDown__itemIcon}/>
39+
<I18n id="userSettings.label" sourceName="Modules" packageKey="Neos.Neos" fallback="User Settings"/>
40+
</a>
41+
</li>
3542
<li className={style.dropDown__item}>
3643
<form title="Logout" action={logoutUri} method="post" role="presentation">
3744
<input type="hidden" name="__csrfToken" value={csrfToken}/>
@@ -41,12 +48,6 @@ export default class UserDropDown extends PureComponent {
4148
</button>
4249
</form>
4350
</li>
44-
<li className={style.dropDown__item}>
45-
<a title="User Settings" href={userSettingsUri}>
46-
<Icon icon="wrench" aria-hidden="true" className={style.dropDown__itemIcon}/>
47-
<I18n id="userSettings.label" sourceName="Modules" packageKey="Neos.Neos" fallback="User Settings"/>
48-
</a>
49-
</li>
5051
{this.props.impersonateStatus === true ? (
5152
<RestoreButtonItem />
5253
) : null}

0 commit comments

Comments
 (0)