Fix resource delete, trash restore, and nested system pages - #17003
Open
Ibochkarev wants to merge 4 commits into
Open
Fix resource delete, trash restore, and nested system pages#17003Ibochkarev wants to merge 4 commits into
Ibochkarev wants to merge 4 commits into
Conversation
The Deleted checkbox on Resource/Update only flipped the current resource, so children stayed live in the tree. Defer the flag to Resource/Delete and Resource/Undelete so form save matches context-menu soft-delete, including deletedon/deletedby.
Restoring a child from trash left its deleted parent in place, and purging a parent only mentioned the parent in the success message. Deleting a folder that contained site_start, error_page, or site_unavailable_page also skipped the root-level protection. Restore now undeletes the ancestor chain. Purge counts removed descendants. Parent delete fails if the tree includes a system page. Creating or moving under a deleted parent is refused.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 3.x #17003 +/- ##
============================================
+ Coverage 21.67% 23.58% +1.91%
- Complexity 10786 10828 +42
============================================
Files 566 567 +1
Lines 33149 33288 +139
============================================
+ Hits 7186 7852 +666
+ Misses 25963 25436 -527 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Connector actions still map Resource/Delete to Processors\Resource, so that package cannot be renamed. Exclude the soft-reserved keyword sniff there and in the legacy processor tests.
Codecov flagged 27 uncovered patch lines. Exercise deferred Delete failure, weblink form delete, move under a deleted parent, nested error_page, purge of parent+child ids, and Undelete of a child.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Checking Deleted on a resource form saved only that resource. Children stayed
deleted=0, so the tree still showed them as live. Restoring a child from trash left its parent deleted, so the child vanished from trash while staying under a trashed folder. Purging a parent permanently removed children but the success message listed only the parent. Movingsite_start, the 404 page, or the unavailable page under a folder, then deleting that folder, bypassed the root-level protection.Resource/Updateleavesdeletedunchanged on its own save, then runsResource/DeleteorResource/Undelete. Trash restore undeletes the ancestor chain. Purge includes descendant ids in the success count. Delete fails if the resource or any descendant issite_start,error_page, orsite_unavailable_page. Create and move refuse a deleted parent.How to test
deletedon/deletedbyset.site_start(or 404 / unavailable) under a folder and try to delete the folder. Delete must fail. The same check already blocks deleting that page at the root.Gate E (this session):
php -lon touched processors: exit 0core/vendor/bin/phpunit -c _build/test/phpunit.xml --filter 'ResourceUpdateDeleteCascadeTest|ResourceTrashHierarchyTest': OK (6 tests, 64 assertions), exit 0site_startblocked; create under deleted parent blockedRelated issue(s)/PR(s)
Resolves #14167. Related: #14350 listed deleted children in trash.
Compatibility notes
Form delete requires the same resource
delete/undeletepolicy as the context menu.Form delete fires
OnBeforeDocFormDelete,OnDocFormDelete, andOnResourceDelete(with children), matching tree Delete.Restore of a child now also undeletes deleted ancestors (and fires
OnResourceUndeletefor them).Breaking change assessment
No public API signature change except removal of unused
fireDeleteEvent/fireUnDeleteEventonResource/Update(no remaining call sites in core). Safe for patch-level consumers unless an extra called those methods directly.Test coverage
ResourceUpdateDeleteCascadeTest: form delete/undelete cascadeResourceTrashHierarchyTest: trash restore of a child restores the parent; purge counts descendants; nestedsite_startblocks parent delete; create under a deleted parent failsContributors
@Ruslan-Aleev reported. @Jako confirmed children must appear in trash because purge removes them with the parent.
AI tool use
Implemented in Cursor with the issue-to-pr pipeline. Review passes on the form-delete cascade: code-reviewer and thermo-nuclear-code-quality-review. Live checks on revolution.test.