Skip to content

Commit

Permalink
Nested draft handling improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Feb 6, 2024
1 parent f0fb0e3 commit 4248abb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- Added `Craft.ElementEditor::markDeltaNameAsModified()`.
- Removed `craft\elements\NestedElementManager::$allowDeletion`.
- Fixed a bug where element editor forms could submit duplicate input values. ([#14276](https://github.com/craftcms/cms/issues/14276))
- Fixed a bug where unedited, unpublished drafts created within Matrix fields would appear on page reload.
- Fixed a bug where nested drafts weren’t getting deleted if no longer needed by a Matrix or Addresses field.

## 5.0.0-alpha.12 - 2024-02-05

Expand Down
3 changes: 3 additions & 0 deletions src/elements/NestedElementManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ private function getValue(ElementInterface $owner, bool $fetchAll = false): Elem
if ($fetchAll && !$query->getCachedResult()) {
$query
->drafts(null)
->savedDraftsOnly()
->status(null)
->limit(null);
}
Expand Down Expand Up @@ -790,6 +791,8 @@ private function deleteOtherNestedElements(ElementInterface $owner, array $excep
{
/** @var NestedElementInterface[] $elements */
$elements = $this->nestedElementQuery($owner)
->drafts(null)
->savedDraftsOnly(false)
->status(null)
->siteId($owner->siteId)
->andWhere(['not', ['elements.id' => $except]])
Expand Down

0 comments on commit 4248abb

Please sign in to comment.