Skip to content

Commit 07d3cfc

Browse files
committed
Cosider policy as well
1 parent dad4117 commit 07d3cfc

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Classes/Fusion/Helper/NodeInfoHelper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,16 @@ protected function getBasicNodeInformation(NodeInterface $node): array
220220
$parent = $node->getParent();
221221
$isAutoCreated = $node->isAutoCreated();
222222
$parentOptions = $parent ? $parent->getNodeType()->getOptions() : [];
223-
223+
$hasAllowHideAutoCreatedOption = isset($parentOptions['allowHideAutoCreatedChildNodes']) && $parentOptions['allowHideAutoCreatedChildNodes'] === true;
224+
$policyForbidsHiding = in_array('_hidden', $this->nodePolicyService->getDisallowedProperties($node));
224225
return [
225226
'contextPath' => $node->getContextPath(),
226227
'name' => $node->getName(),
227228
'identifier' => $node->getIdentifier(),
228229
'nodeType' => $node->getNodeType()->getName(),
229230
'label' => $node->getLabel(),
230231
'isAutoCreated' => $isAutoCreated,
231-
'disableChangeVisibility' => $isAutoCreated && !(isset($parentOptions['allowHideAutoCreatedChildren']) && $parentOptions['allowHideAutoCreatedChildren'] === true),
232+
'disableChangeVisibility' => $policyForbidsHiding || ($isAutoCreated && !$hasAllowHideAutoCreatedOption),
232233
'depth' => $node->getDepth(),
233234
'children' => [],
234235
// In some rare cases the parent node cannot be resolved properly

packages/neos-ui-guest-frame/src/InlineUI/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, {PureComponent} from 'react';
22
import PropTypes from 'prop-types';
33
import {connect} from 'react-redux';
4-
import {$transform, $get, $contains} from 'plow-js';
4+
import {$transform, $get} from 'plow-js';
55
import {actions, selectors} from '@neos-project/neos-ui-redux-store';
66
import {neos} from '@neos-project/neos-ui-decorators';
77

@@ -53,7 +53,7 @@ export default class InlineUI extends PureComponent {
5353
const isCopied = allFocusedNodesAreInClipboard && clipboardMode === 'Copy';
5454
const canBeDeleted = $get('policy.canRemove', this.props.focusedNode) || false;
5555
const canBeEdited = $get('policy.canEdit', this.props.focusedNode) || false;
56-
const visibilityCanBeToggled = !$contains('_hidden', 'policy.disallowedProperties', this.props.focusedNode) && !$get('disableChangeVisibility', this.props.focusedNode);
56+
const visibilityCanBeToggled = !$get('disableChangeVisibility', this.props.focusedNode);
5757

5858
return (
5959
<div className={style.inlineUi} data-__neos__inline-ui="TRUE">

packages/neos-ui/src/Containers/LeftSideBar/NodeTreeToolBar/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ const removeAllowed = (focusedNodesContextPaths, state) => focusedNodesContextPa
231231
const visibilityToggleAllowed = (focusedNodesContextPaths, state) => focusedNodesContextPaths.every(contextPath => {
232232
const getNodeByContextPathSelector = selectors.CR.Nodes.makeGetNodeByContextPathSelector(contextPath);
233233
const focusedNode = getNodeByContextPathSelector(state);
234-
return !$contains('_hidden', 'policy.disallowedProperties', focusedNode) && !$get('disableChangeVisibility', focusedNode);
234+
console.log(focusedNode);
235+
return !$get('disableChangeVisibility', focusedNode);
235236
});
236237
const editingAllowed = (focusedNodesContextPaths, state) => focusedNodesContextPaths.every(contextPath => {
237238
const getNodeByContextPathSelector = selectors.CR.Nodes.makeGetNodeByContextPathSelector(contextPath);

0 commit comments

Comments
 (0)