refactor(submit): remove unused aksrt_update_post ajax endpoint

No caller anywhere: front JS updates via aksrt_submit_post (posts_id),
guests via aksrt_save_draft. Re-pin the one-captcha-admission contract
to ajax_submit_post, the only non-draft entry point.
This commit is contained in:
2026-09-05 23:41:12 +08:00
parent 5fbcfa2b49
commit d84d485ec7
2 changed files with 5 additions and 24 deletions
@@ -100,12 +100,13 @@ test('public theme does not inject a global focus-visible ring', () => {
test('non-draft front-submit updates require one server captcha admission', () => {
const controller = read('src/Core/FrontSubmit.php');
const start = controller.indexOf('public function ajax_update_post(): void');
const end = controller.indexOf('\n public function ajax_delete_draft', start);
// Edits ride the same submit endpoint (posts_id + posts_save), which is the
// only non-draft entry point and always verifies captcha before persisting.
const start = controller.indexOf('public function ajax_submit_post(): void');
const end = controller.indexOf('\n public function ajax_save_draft', start);
const body = controller.slice(start, end);
assert.match(body, /\$action = \(\(\$data\['status'\] \?\? ''\) === 'draft'\) \? 'posts_draft' : 'posts_save';/);
assert.match(body, /if \(\$action !== 'posts_draft'\) \{\s*\$this->verify_captcha\(\);\s*\}/);
assert.match(body, /\$this->verify_nonce\(\);\s*\$this->verify_captcha\(\);\s*\$data = wp_unslash\(\$_POST\);\s*\$result = \$this->persist\(is_array\(\$data\) \? \$data : \[\], 'posts_save'\);/);
assert.match(controller, /get_error_code\(\)/);
assert.match(controller, /get_error_message\(\)/);
});