Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/8.2' into 8.3
Browse files Browse the repository at this point in the history
# Conflicts:
#	Neos.Neos/Documentation/References/EelHelpersReference.rst
#	Neos.Neos/Documentation/References/FlowQueryOperationReference.rst
#	Neos.Neos/Documentation/References/Signals/ContentRepository.rst
#	Neos.Neos/Documentation/References/Signals/Flow.rst
#	Neos.Neos/Documentation/References/Signals/Media.rst
#	Neos.Neos/Documentation/References/Signals/Neos.rst
#	Neos.Neos/Documentation/References/Validators/Flow.rst
#	Neos.Neos/Documentation/References/Validators/Media.rst
#	Neos.Neos/Documentation/References/Validators/Party.rst
#	Neos.Neos/Documentation/References/ViewHelpers/ContentRepository.rst
#	Neos.Neos/Documentation/References/ViewHelpers/FluidAdaptor.rst
#	Neos.Neos/Documentation/References/ViewHelpers/Form.rst
#	Neos.Neos/Documentation/References/ViewHelpers/Fusion.rst
#	Neos.Neos/Documentation/References/ViewHelpers/Media.rst
#	Neos.Neos/Documentation/References/ViewHelpers/Neos.rst
#	Neos.Neos/Documentation/References/ViewHelpers/TYPO3Fluid.rst
#	Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Show.html
  • Loading branch information
markusguenther committed Feb 23, 2023
2 parents 53b1ab6 + 173ad38 commit 89d4c84
Show file tree
Hide file tree
Showing 49 changed files with 611 additions and 113 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/add-pr-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Add Labels to Pull Request

on:
pull_request:
types: [opened, reopened, synchronize, edited]

jobs:
add-labels:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Maybe remove base branch label
if: github.event.action == 'edited' && github.event.changes.base.ref.from != ''
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: ${{ github.event.changes.base.ref.from }}
- name: Add feature label
if: startsWith(github.event.pull_request.title, 'FEATURE:')
uses: actions-ecosystem/action-add-labels@v1
with:
labels: 'Feature'
- name: Add bugfix label
if: startsWith(github.event.pull_request.title, 'BUGFIX:')
uses: actions-ecosystem/action-add-labels@v1
with:
labels: 'Bug'
- name: Add task label
if: startsWith(github.event.pull_request.title, 'TASK:')
uses: actions-ecosystem/action-add-labels@v1
with:
labels: 'Task'
- name: Add target branch label
uses: actions-ecosystem/action-add-labels@v1
with:
labels: ${{ github.base_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ protected function parsePropertiesElement(\XMLReader $reader, $currentNodeIdenti
$currentClassName = $reader->getAttribute('__classname');
$currentEncoding = $reader->getAttribute('__encoding');

// handle self-closing tags
if ($reader->isEmptyElement) {
switch ($currentType) {
case 'array':
Expand All @@ -452,6 +453,21 @@ protected function parsePropertiesElement(\XMLReader $reader, $currentNodeIdenti
}
break;
case \XMLReader::END_ELEMENT:
// handle empty tags
if ($reader->name === $currentProperty && !isset($properties[$currentProperty])) {
switch ($currentType) {
case 'array':
$properties[$currentProperty] = [];
break;
case 'string':
$properties[$currentProperty] = '';
break;
default:
$properties[$currentProperty] = null;
}
$currentType = null;
}

if ($reader->name === 'properties') {
return $properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public function setPropertyName(string $propertyName): void
/**
* Sets the property value to be checked against.
*
* @param string $propertyValue
* @param string|bool|int $propertyValue
* @return void
*/
public function setPropertyValue(string $propertyValue): void
public function setPropertyValue($propertyValue): void
{
$this->propertyValue = $propertyValue;
}
Expand All @@ -64,10 +64,10 @@ public function getFilterExpressions(Query $baseQuery): array
{
// Build the like parameter as "key": "value" to search by a specific key and value
// See NodeDataRepository.findByProperties() for the "inspiration"
$likeParameter = trim(json_encode(
$likeParameter = sprintf("%%%s%%", trim(json_encode(
[$this->propertyName => $this->propertyValue],
JSON_PRETTY_PRINT | JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE
), "{}\n\t ");
), "{}\n\t "));

return [$baseQuery->like('properties', $likeParameter, false)];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@ public function execute()
protected function executeSingle(array $migrationDescription)
{
$filterExpressions = [];
$baseQuery = new Query(NodeData::class);
foreach ($this->nodeFilterService->getFilterExpressions($migrationDescription['filters'], $baseQuery) as $filterExpression) {
$query = new Query(NodeData::class);
foreach ($this->nodeFilterService->getFilterExpressions($migrationDescription['filters'], $query) as $filterExpression) {
$filterExpressions[] = $filterExpression;
}

$query = new Query(NodeData::class);
if ($filterExpressions !== []) {
$query->matching(call_user_func_array([new Expr(), 'andX'], $filterExpressions));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function importSingleNode()
'layout' => 'landingPage',
'uriPathSegment' => 'home',
'imageTitleText' => 'Photo by www.daniel-bischoff.photo',
'subpageLayout' => '',
],
'accessRoles' => [],
'hiddenBeforeDateTime' => new \DateTime('2015-10-01T03:45:04+02:00'),
Expand Down Expand Up @@ -191,6 +192,7 @@ public function importWithEmptyPropertyImportsAllProperties()
'title' => 'Home',
'layout' => 'landingPage',
'uriPathSegment' => 'home',
'relatedDocuments' => [],
'image' =>
[
'targetType' => \Neos\Media\Domain\Model\ImageVariant::class,
Expand Down Expand Up @@ -242,7 +244,7 @@ public function importWithEmptyPropertyImportsAllProperties()
],
],
'imageTitleText' => 'Photo by www.daniel-bischoff.photo',
'relatedDocuments' => []
'subpageLayout' => '',
],
'accessRoles' => [],
'dimensionValues' => [
Expand Down
2 changes: 1 addition & 1 deletion Neos.Media/Documentation/ThumbnailPresets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ parameters used in ``ThumbnailConfiguration``, except for the ``async`` paramete

.. code-block:: yaml
TYPO3:
Neos:
Media:
thumbnailPresets:
'Acme.Demo:Thumbnail':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ protected function setGlobalUiElementLabels($nodeTypeName, array &$configuration
};
$this->applyEditorLabels($nodeTypeLabelIdPrefix, $elementName, $elementConfiguration['ui']['editor'], $elementConfiguration['ui']['editorOptions'], $translationIdGenerator);
}
if (!is_array($elementConfiguration) || !$this->shouldFetchTranslation($elementConfiguration['ui'])) {
if (!is_array($elementConfiguration) || !$this->shouldFetchTranslation($elementConfiguration['ui'] ?? [])) {
continue;
}
$elementConfiguration['ui']['label'] = $this->getInspectorElementTranslationId($nodeTypeLabelIdPrefix, 'creationDialog', $elementName);
Expand Down
69 changes: 42 additions & 27 deletions Neos.Neos/Classes/Controller/Backend/MenuHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@
* source code.
*/

use Neos\ContentRepository\Security\Authorization\Privilege\Node\NodePrivilegeSubject;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Http\Exception;
use Neos\Flow\Mvc\Controller\ControllerContext;
use Neos\Flow\Mvc\Routing\Exception\MissingActionNameException;
use Neos\Flow\Security\Authorization\PrivilegeManagerInterface;
use Neos\Neos\Domain\Service\ContentContextFactory;
use Neos\Neos\Domain\Service\SiteService;
use Neos\Neos\Security\Authorization\Privilege\ModulePrivilege;
use Neos\Neos\Security\Authorization\Privilege\ModulePrivilegeSubject;
use Neos\Neos\Security\Authorization\Privilege\NodeTreePrivilege;
use Neos\Neos\Service\IconNameMappingService;
use Neos\Utility\Arrays;
use Neos\Neos\Domain\Model\Site;
Expand All @@ -31,7 +36,7 @@
class MenuHelper
{
/**
* @var array
* @var array|null
*/
protected $moduleListFirstLevelCache = null;

Expand All @@ -58,10 +63,16 @@ class MenuHelper
*/
protected $iconMapper;

/**
* @Flow\Inject
* @var ContentContextFactory
*/
protected $contextFactory;

/**
* @param array $settings
*/
public function injectSettings(array $settings)
public function injectSettings(array $settings): void
{
$this->settings = $settings;
}
Expand All @@ -71,6 +82,7 @@ public function injectSettings(array $settings)
*
* @param ControllerContext $controllerContext
* @return array
* @throws MissingActionNameException|Exception
*/
public function buildSiteList(ControllerContext $controllerContext): array
{
Expand All @@ -81,34 +93,38 @@ public function buildSiteList(ControllerContext $controllerContext): array
return [];
}

$context = $this->contextFactory->create();
$domainsFound = false;
$sites = [];
foreach ($this->siteRepository->findOnline() as $site) {
$uri = null;
$active = false;
/** @var $site Site */
if ($site->hasActiveDomains()) {
$activeHostPatterns = $site->getActiveDomains()->map(static function ($domain) {
return $domain->getHostname();
})->toArray();

$active = in_array($requestUriHost, $activeHostPatterns, true);

if ($active) {
$uri = $contentModule['uri'];
} else {
$uri = $controllerContext->getUriBuilder()->reset()->uriFor('switchSite', ['site' => $site], 'Backend\Backend', 'Neos.Neos');
$node = $context->getNode(\Neos\ContentRepository\Domain\Utility\NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $site->getNodeName()));
if ($this->privilegeManager->isGranted(NodeTreePrivilege::class, new NodePrivilegeSubject($node))) {
$uri = null;
$active = false;
/** @var $site Site */
if ($site->hasActiveDomains()) {
$activeHostPatterns = $site->getActiveDomains()->map(static function ($domain) {
return $domain->getHostname();
})->toArray();

$active = in_array($requestUriHost, $activeHostPatterns, true);

if ($active) {
$uri = $contentModule['uri'];
} else {
$uri = $controllerContext->getUriBuilder()->reset()->uriFor('switchSite', ['site' => $site], 'Backend\Backend', 'Neos.Neos');
}

$domainsFound = true;
}

$domainsFound = true;
$sites[] = [
'name' => $site->getName(),
'nodeName' => $site->getNodeName(),
'uri' => $uri,
'active' => $active
];
}

$sites[] = [
'name' => $site->getName(),
'nodeName' => $site->getNodeName(),
'uri' => $uri,
'active' => $active
];
}

if ($domainsFound === false) {
Expand All @@ -121,8 +137,7 @@ public function buildSiteList(ControllerContext $controllerContext): array
/**
* @param ControllerContext $controllerContext
* @return array
* @throws \Neos\Flow\Http\Exception
* @throws MissingActionNameException
* @throws Exception|MissingActionNameException
*/
public function buildModuleList(ControllerContext $controllerContext): array
{
Expand Down Expand Up @@ -202,7 +217,7 @@ public function isModuleEnabled(string $modulePath): bool
* @param array $moduleConfiguration
* @param string $modulePath
* @return array
* @throws \Neos\Flow\Http\Exception
* @throws Exception
* @throws MissingActionNameException
*/
protected function collectModuleData(ControllerContext $controllerContext, string $module, array $moduleConfiguration, string $modulePath): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,15 +721,20 @@ protected function postProcessDiffArray(array &$diffArray)
* Creates an array of workspace names and their respective titles which are possible base workspaces for other
* workspaces.
*
* @param Workspace $excludedWorkspace If set, this workspace will be excluded from the list of returned workspaces
* @param Workspace $excludedWorkspace If set, this workspace and all its child workspaces will be excluded from the list of returned workspaces
* @return array
*/
protected function prepareBaseWorkspaceOptions(Workspace $excludedWorkspace = null)
{
$baseWorkspaceOptions = [];

foreach ($this->workspaceRepository->findAll() as $workspace) {
/** @var Workspace $workspace */
if (!$workspace->isPersonalWorkspace() && $workspace !== $excludedWorkspace && ($workspace->isPublicWorkspace() || $workspace->isInternalWorkspace() || $this->userService->currentUserCanManageWorkspace($workspace))) {
if (!$workspace->isPersonalWorkspace() &&
$workspace !== $excludedWorkspace &&
($workspace->isPublicWorkspace() || $workspace->isInternalWorkspace() || $this->userService->currentUserCanManageWorkspace($workspace)) &&
(!$excludedWorkspace || !isset($workspace->getBaseWorkspaces()[$excludedWorkspace->getName()]))
) {
$baseWorkspaceOptions[$workspace->getName()] = $workspace->getTitle();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ private function convertPropertyConfiguration(string $propertyName, array $prope
if (isset($propertyConfiguration['validation'])) {
$convertedConfiguration['validation'] = $propertyConfiguration['validation'];
}
if (isset($propertyConfiguration['position'])) {
$convertedConfiguration['position'] = $propertyConfiguration['position'];
if (isset($propertyConfiguration['ui']['inspector']['position'])) {
$convertedConfiguration['position'] = $propertyConfiguration['ui']['inspector']['position'];
}

$editor = $propertyConfiguration['ui']['inspector']['editor'] ?? $dataTypeDefaultConfiguration['editor'] ?? 'Neos.Neos/Inspector/Editors/TextFieldEditor';
Expand Down
3 changes: 3 additions & 0 deletions Neos.Neos/Classes/Service/NodeTypeSchemaBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ protected function generateConstraints()
$nodeTypes = $this->nodeTypeManager->getNodeTypes(true);
/** @var NodeType $nodeType */
foreach ($nodeTypes as $nodeTypeName => $nodeType) {
if ($nodeType->isAbstract()) {
continue;
}
$constraints[$nodeTypeName] = [
'nodeTypes' => [],
'childNodes' => []
Expand Down
2 changes: 2 additions & 0 deletions Neos.Neos/Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ Neos:
label: 'Neos.Neos:Modules:user.label'
controller: \Neos\Neos\Controller\Module\UserController
hideInMenu: true
description: 'Neos.Neos:Modules:user.description'
icon: fas fa-users
mainStylesheet: 'Lite'
submodules:
usersettings:
Expand Down
2 changes: 1 addition & 1 deletion Neos.Neos/Documentation/References/EelHelpersReference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Eel Helpers Reference
=====================

This reference was automatically generated from code on 2023-02-22
This reference was automatically generated from code on 2023-02-23


.. _`Eel Helpers Reference: Api`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
FlowQuery Operation Reference
=============================

This reference was automatically generated from code on 2023-02-22
This reference was automatically generated from code on 2023-02-23


.. _`FlowQuery Operation Reference: add`:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 89d4c84

Please sign in to comment.