Skip to content
Draft

5.11 #19062

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG-5.11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Release Notes for Craft CMS 5.11 (WIP)

### Development
- The `params` argument of the `url()` Twig function now accepts `false` to remove all params from the passed-in URL. ([#19102](https://github.com/craftcms/cms/pull/19102))
- Added `craft\web\DbSession`, which should be used instead of `yii\web\DbSession` to prevent “headers already sent” warnings from getting logged. ([#19139](https://github.com/craftcms/cms/issues/19139))

### Extensibility
- Added `craft\helpers\UrlHelper::removeAllParams()`. ([#19102](https://github.com/craftcms/cms/pull/19102))
- Added `craft\helpers\UrlHelper::removeParams()`. ([#19102](https://github.com/craftcms/cms/pull/19102))
- Added `craft\services\Elements::reorderNestedElements()`. ([#19321](https://github.com/craftcms/cms/issues/19321))
- The `$params` argument of `craft\helpers\UrlHelper::url()` now accepts `false` to remove all params from the passed-in URL. ([#19102](https://github.com/craftcms/cms/pull/19102))

### System
- Added support for `.well-known/passkey-endpoints` requests. ([#19364](https://github.com/craftcms/cms/pull/19364))
- Updated Twig to 3.28.
- Updated yii2-debug to 2.1.28.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
"symfony/var-dumper": "^5.0|^6.0|^7.0",
"symfony/yaml": "^5.2.3|^6.0|^7.0",
"theiconic/name-parser": "^1.2",
"twig/twig": "~3.27.0",
"twig/twig": "~3.28.0",
"voku/portable-ascii": "^2.0",
"web-auth/webauthn-lib": "~5.3.5",
"yiisoft/yii2": "~2.0.55.0",
"yiisoft/yii2-debug": "~2.1.27.0",
"yiisoft/yii2-debug": "~2.1.28.0",
"yiisoft/yii2-queue": "~2.3.2",
"yiisoft/yii2-symfonymailer": "^4.0.0"
},
Expand Down
72 changes: 31 additions & 41 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 1 addition & 33 deletions src/controllers/NestedElementsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

use Craft;
use craft\base\ElementInterface;
use craft\base\NestedElementInterface;
use craft\db\Table;
use craft\elements\db\ElementQueryInterface;
use craft\elements\ElementCollection;
Expand Down Expand Up @@ -82,38 +81,7 @@ public function actionReorder(): Response
$ids = array_map(fn($id) => (int)$id, $this->request->getRequiredBodyParam('elementIds'));
$offset = $this->request->getRequiredBodyParam('offset');

if ($this->nestedElements instanceof ElementQueryInterface) {
$oldSortOrders = (clone $this->nestedElements)
->status(null)
->asArray()
->select(['id', 'sortOrder'])
->pairs();
} else {
$oldSortOrders = $this->nestedElements
->keyBy(fn(ElementInterface $element) => $element->id)
/** @phpstan-ignore-next-line */
->map(fn(NestedElementInterface $element) => $element->getSortOrder())
->all();
}

// Build the full list of IDs in the new sort order
$allIds = array_diff(array_keys($oldSortOrders), $ids);
array_splice($allIds, $offset, 0, $ids);

// Update all the incorrect sort orders
foreach ($allIds as $i => $id) {
$sortOrder = $i + 1;
if (!isset($oldSortOrders[$id]) || $sortOrder !== $oldSortOrders[$id]) {
Db::update(Table::ELEMENTS_OWNERS, [
'sortOrder' => $sortOrder,
], [
'ownerId' => $this->owner->id,
'elementId' => $id,
]);
}
}

Craft::$app->getElements()->invalidateCachesForElement($this->owner);
Craft::$app->getElements()->reorderNestedElements($this->owner, $this->nestedElements, $ids, $offset);

return $this->asSuccess(Craft::t('app', 'New {total, plural, =1{position} other{positions}} saved.', [
'total' => count($ids),
Expand Down
30 changes: 30 additions & 0 deletions src/controllers/WellKnownController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* @link https://craftcms.com/
* @copyright Copyright (c) Pixel & Tonic, Inc.
* @license https://craftcms.github.io/license/
*/

namespace craft\controllers;

use craft\web\Controller;
use yii\web\Response;

/**
* Class WellKnownController
*
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
* @since 5.11.0
*/
class WellKnownController extends Controller
{
protected array|bool|int $allowAnonymous = self::ALLOW_ANONYMOUS_LIVE;

public function actionPasskeyEndpoints(): Response
{
// Just return an empty object to signal support for passkeys, w/o leaking the CP URL.
$this->response->format = Response::FORMAT_JSON;
$this->response->content = '{}';
return $this->response;
}
}
Loading
Loading