fix(uploads): reclaim abandoned front-submit attachments

Mark new regular and chunked uploads as pending and claim persisted article references, including partial saves and large reference sets. Protect associated media from cleanup and add upload lifecycle regression coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-10-30 21:57:46 +08:00
1 parent f9b7997ec2
commit 32ac2112b0
10 files changed
+960 -26

No files matched your search

@@ -10,6 +10,7 @@ const read = (file) => fs.readFileSync(path.join(root, file), 'utf8');
const frontSubmit = read('src/Core/FrontSubmit.php');
const mediaTrait = read('src/Core/FrontSubmitMedia.php');
const saveTrait = read('src/Core/FrontSubmitSave.php');
const page = read('templates/pages/page-submit.php');
const editor = read('assets/js/front-submit-editor.js');
const submit = read('assets/js/front-submit.js');
@@ -26,8 +27,8 @@ const runtimeFiles = [
test('front submit owns the typed media REST routes and media trait wiring', () => {
assert.match(frontSubmit, /use FrontSubmitMedia\s*;/);
assert.match(frontSubmit, /add_action\('rest_api_init', \[\$this, 'register_rest_routes'\]\)/);
assert.match(frontSubmit, /add_action\('aksrt_new_add_posts', \[\$this, 'sync_post_attachments'\]\)/);
assert.match(frontSubmit, /add_action\('aksrt_new_edit_posts', \[\$this, 'sync_post_attachments'\]\)/);
assert.doesNotMatch(frontSubmit, /add_action\('aksrt_new_(?:add|edit)_posts', \[\$this, 'sync_post_attachments'\]\)/);
assert.match(saveTrait, /\$this->sync_post_attachments\(\$post\);\s*if \(!\$pay_result\['success'\]\)/);
assert.match(frontSubmit, /register_rest_route\('aksrt\/v1', '\/front-submit\/media\/\(\?P<type>image\|video\|file\)'/);
assert.match(frontSubmit, /'methods'\s*=>\s*\\WP_REST_Server::READABLE/);