Skip to content

Commit

Permalink
Merge branch '8.3' into 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
DDEV User committed Sep 6, 2024
2 parents ed79f5f + aaddb43 commit ef53627
Show file tree
Hide file tree
Showing 29 changed files with 316 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/add-pr-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Maybe remove base branch label
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
working-directory: .

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: ${{ env.NEOS_FOLDER }}

Expand All @@ -96,7 +96,7 @@ jobs:
ini-values: date.timezone="Africa/Tunis", opcache.fast_shutdown=0, apc.enable_cli=on

- name: Checkout development distribution
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: neos/neos-development-distribution
ref: ${{ env.NEOS_TARGET_VERSION }}
Expand All @@ -113,7 +113,7 @@ jobs:
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cache/composer
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/doctum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build-api-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build API documentation
uses: sudo-bot/action-doctum@v5
Expand All @@ -20,7 +20,7 @@ jobs:
cli-args: "--output-format=github --no-ansi --no-progress --ignore-parse-errors --only-version=${{ github.ref_name }}"

- name: Check out documentation site
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: neos/neos.github.io
path: docs-site
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/postgresql-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
working-directory: .

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: ${{ env.NEOS_FOLDER }}

Expand All @@ -80,7 +80,7 @@ jobs:
ini-values: date.timezone="Africa/Tunis", opcache.fast_shutdown=0, apc.enable_cli=on

- name: Checkout development distribution
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: neos/neos-development-distribution
ref: ${{ env.NEOS_TARGET_VERSION }}
Expand All @@ -102,7 +102,7 @@ jobs:
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cache/composer
Expand Down
4 changes: 4 additions & 0 deletions Neos.ContentRepository/Classes/Domain/Model/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,10 @@ protected function createRecursiveCopy(NodeInterface $referenceNode, string $nod
}
/** @var $childNode Node */
foreach ($this->getChildNodes() as $childNode) {
// Don't copy removed nodes
if ($childNode->isRemoved()) {
continue;
}
// Prevent recursive copy when copying into itself
if ($childNode->getIdentifier() !== $copiedNode->getIdentifier()) {
$childNode->copyIntoInternal($copiedNode, $childNode->getName(), $detachedCopy);
Expand Down
1 change: 1 addition & 0 deletions Neos.ContentRepository/Classes/Domain/Model/NodeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ public function similarize(AbstractNodeData $sourceNode, $isCopy = false)
}
if ($sourceNode instanceof NodeData) {
$propertyNames[] = 'index';
$propertyNames[] = 'removed';
}
foreach ($propertyNames as $propertyName) {
ObjectAccess::setProperty($this, $propertyName, ObjectAccess::getProperty($sourceNode, $propertyName));
Expand Down
28 changes: 28 additions & 0 deletions Neos.ContentRepository/Tests/Functional/Domain/NodesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,34 @@ public function removedNodesAreNotCountedAsChildNodes()
self::assertFalse($rootNode->hasChildNodes(), 'Third check.');
}

/**
* @test
*/
public function removedChildNodesAreNotCopied()
{
$rootNode = $this->context->getRootNode();
$parentNode = $rootNode->createNode('parent');
$parentNode->createNode('child');

$context = $this->contextFactory->create([
'workspaceName' => 'user-admin',
'removedContentShown' => true,
]);
$this->persistenceManager->persistAll();

$rootNode = $context->getRootNode();
$parentNode = $rootNode->getNode('parent');
self::assertTrue($parentNode->hasChildNodes(), 'Parent node should have child nodes, before they are removed');

$parentNode->getNode('child')->remove();
$this->persistenceManager->persistAll();

$parentNode = $rootNode->getNode('parent');
$parentClone = $parentNode->copyInto($rootNode, 'parent-clone');

self::assertFalse($parentClone->hasChildNodes(), 'Copied parent node should not have any child nodes');
}

/**
* @test
*/
Expand Down
7 changes: 6 additions & 1 deletion Neos.Media.Browser/Classes/Controller/AssetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@
*/
class AssetController extends ActionController
{
use CreateContentContextTrait;
use BackendUserTranslationTrait;
use BackendUserTranslationTrait {
BackendUserTranslationTrait::initializeObject as backendUserTranslationTraitInitializeObject;
}
use CreateContentContextTrait;
use AddTranslatedFlashMessageTrait;

protected const TAG_GIVEN = 0;
Expand Down Expand Up @@ -170,6 +173,8 @@ class AssetController extends ActionController
*/
public function initializeObject(): void
{
$this->backendUserTranslationTraitInitializeObject();

$domain = $this->domainRepository->findOneByActiveRequest();

// Set active asset collection to the current site's asset collection, if it has one, on the first view if a matching domain is found
Expand Down
2 changes: 1 addition & 1 deletion Neos.Media.Browser/Resources/Private/Layouts/Default.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
<div class="neos-media-content{f:if(condition: '{tags -> f:count()} > 25', then: ' neos-media-aside-condensed')}">
<div class="neos-media-assets">
<div class="neos-notification-container">
<div id="neos-notification-container" class="neos-notification-container">
<f:render partial="FlashMessages"/>
</div>
<f:render section="Content"/>
Expand Down
114 changes: 83 additions & 31 deletions Neos.Media.Browser/Resources/Public/JavaScript/select.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,84 @@
window.addEventListener('DOMContentLoaded', (event) => {
$(function() {
if (window.parent !== window && window.parent.NeosMediaBrowserCallbacks) {
// we are inside iframe
$('.asset-list').on('click', '[data-asset-identifier]', function(e) {
if (
$(e.target).closest('a, button').not('[data-asset-identifier]').length === 0 &&
window.parent.NeosMediaBrowserCallbacks &&
typeof window.parent.NeosMediaBrowserCallbacks.assetChosen === 'function'
) {
let localAssetIdentifier = $(this).attr('data-local-asset-identifier');
if (localAssetIdentifier !== '') {
window.parent.NeosMediaBrowserCallbacks.assetChosen(localAssetIdentifier);
} else {
$.post(
$('link[rel="neos-media-browser-service-assetproxies-import"]').attr('href'),
{
assetSourceIdentifier: $(this).attr('data-asset-source-identifier'),
assetIdentifier: $(this).attr('data-asset-identifier'),
__csrfToken: $('body').attr('data-csrf-token')
},
function(data) {
window.parent.NeosMediaBrowserCallbacks.assetChosen(data.localAssetIdentifier);
}
);
}
e.preventDefault();
}
});
}
});
window.addEventListener('DOMContentLoaded', () => {
(function () {
const NeosMediaBrowserCallbacks = window.parent.NeosMediaBrowserCallbacks;
const NeosCMS = window.NeosCMS;

if (window.parent === window || !NeosCMS || !NeosMediaBrowserCallbacks || typeof NeosMediaBrowserCallbacks.assetChosen !== 'function') {
return;
}

function importAsset(asset) {
const params = new URLSearchParams();
params.append('assetSourceIdentifier', asset.dataset.assetSourceIdentifier);
params.append('assetIdentifier', asset.dataset.assetIdentifier);
params.append('__csrfToken', document.querySelector('body').dataset.csrfToken);

fetch(
document
.querySelector('link[rel="neos-media-browser-service-assetproxies-import"]')
.getAttribute('href'),
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
},
method: 'POST',
credentials: 'include',
body: params.toString(),
}
)
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
})
.then((data) => {
NeosMediaBrowserCallbacks.assetChosen(data.localAssetIdentifier);
asset.removeAttribute('data-import-in-process');
})
.catch((error) => {
NeosCMS.Notification.error(NeosCMS.I18n.translate(
'assetImport.importError',
'Asset could not be imported. Please try again.',
'Neos.Media.Browser'
), error);
console.error('Error:', error);
})
}

const assets = document.querySelectorAll('[data-asset-identifier]');
assets.forEach((asset) => {
asset.addEventListener('click', (e) => {
const assetLink = e.target.closest('a[data-asset-identifier], button[data-asset-identifier]');
if (!assetLink) {
return;
}

const localAssetIdentifier = asset.dataset.localAssetIdentifier;
if (localAssetIdentifier !== '' && !NeosCMS.Helper.isNil(localAssetIdentifier)) {
NeosMediaBrowserCallbacks.assetChosen(localAssetIdentifier);
} else {
if (asset.dataset.importInProcess !== 'true') {
asset.dataset.importInProcess = 'true';
const message = NeosCMS.I18n.translate(
'assetImport.importInfo',
'Asset is being imported. Please wait.',
'Neos.Media.Browser'
);
NeosCMS.Notification.ok(message);

importAsset(asset);
} else {
const message = NeosCMS.I18n.translate(
'assetImport.importInProcess',
'Import still in process. Please wait.',
'Neos.Media.Browser'
);
NeosCMS.Notification.warning(message);
}
}
e.preventDefault();
});
});
})();
});
1 change: 1 addition & 0 deletions Neos.Neos/Classes/Controller/Backend/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public function indexAction(array $module)
$moduleResponse = new ActionResponse();

$this->dispatcher->dispatch($moduleRequest, $moduleResponse);
$moduleResponse->mergeIntoParentResponse($this->response);

if ($moduleResponse->getRedirectUri() !== null) {
$this->redirectToUri($moduleResponse->getRedirectUri(), 0, $moduleResponse->getStatusCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ protected function getAllowedRoles(): array
$roles = $this->userService->currentUserIsAdministrator() ? $this->policyService->getRoles() : $currentUserRoles;

usort($roles, static function (Role $a, Role $b) {
return strcmp($a->getName(), $b->getName());
return strcmp($a->getLabel(), $b->getLabel());
});

return $roles;
Expand Down
16 changes: 1 addition & 15 deletions Neos.Neos/Classes/Controller/Service/NodesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use Neos\Neos\View\Service\NodeJsonView;
use Neos\Neos\Service\Mapping\NodePropertyConverterService;
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\ContentRepository\Domain\Model\NodeType;
use Neos\ContentRepository\Domain\Service\NodeTypeManager;
use Neos\ContentRepository\Domain\Utility\NodePaths;

Expand Down Expand Up @@ -93,22 +92,9 @@ class NodesController extends ActionController
*/
public function indexAction($searchTerm = '', array $nodeIdentifiers = [], $workspaceName = 'live', array $dimensions = [], array $nodeTypes = ['Neos.Neos:Document'], NodeInterface $contextNode = null)
{
$searchableNodeTypeNames = [];
foreach ($nodeTypes as $nodeTypeName) {
if (!$this->nodeTypeManager->hasNodeType($nodeTypeName)) {
$this->throwStatus(400, sprintf('Unknown node type "%s"', $nodeTypeName));
}

$searchableNodeTypeNames[$nodeTypeName] = $nodeTypeName;
/** @var NodeType $subNodeType */
foreach ($this->nodeTypeManager->getSubNodeTypes($nodeTypeName, false) as $subNodeTypeName => $subNodeType) {
$searchableNodeTypeNames[$subNodeTypeName] = $subNodeTypeName;
}
}

$contentContext = $this->createContentContext($workspaceName, $dimensions);
if ($nodeIdentifiers === []) {
$nodes = $this->nodeSearchService->findByProperties($searchTerm, $searchableNodeTypeNames, $contentContext, $contextNode);
$nodes = $this->nodeSearchService->findByProperties($searchTerm, $nodeTypes, $contentContext, $contextNode);
} else {
$nodes = array_filter(
array_map(function ($identifier) use ($contentContext) {
Expand Down
4 changes: 2 additions & 2 deletions Neos.Neos/Classes/Domain/Repository/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public function findBySearchTerm(string $searchTerm, string $sortBy, string $sor
$query = $this->createQuery();
$query->matching(
$query->logicalOr(
$query->like('accounts.accountIdentifier', '%' . $searchTerm . '%'),
$query->like('name.fullName', '%' . $searchTerm . '%')
$query->like('accounts.accountIdentifier', '%' . $searchTerm . '%', false),
$query->like('name.fullName', '%' . $searchTerm . '%', false)
)
);
return $query->setOrderings([$sortBy => $sortDirection])->execute();
Expand Down
2 changes: 1 addition & 1 deletion Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ protected function registerAllTagsToFlushForNodeInWorkspace(NodeInterface $node,
{
// Ensure that we're dealing with the variant of the given node that actually
// lives in the given workspace
if ($node->getWorkspace()->getName() !== $workspace->getName()) {
if ($node->isRemoved() === false && $node->getWorkspace()->getName() !== $workspace->getName()) {
$workspaceContext = $this->contextFactory->create(
array_merge(
$node->getContext()->getProperties(),
Expand Down
Loading

0 comments on commit ef53627

Please sign in to comment.