diff --git a/src/User/ProfileAdmin.php b/src/User/ProfileAdmin.php index 7e0cc5e6..514127f0 100644 --- a/src/User/ProfileAdmin.php +++ b/src/User/ProfileAdmin.php @@ -85,8 +85,8 @@ final class ProfileAdmin { ID : (int) ($_POST['user_id'] ?? 0); + public static function validate(\WP_Error $errors, bool $update, \stdClass $user): void { + $user_id = (int) ($user->ID ?? 0); if ($user_id <= 0 || !current_user_can('edit_user', $user_id) || empty($_POST[self::PROFILE_NONCE])) { return; } diff --git a/tests/widget-system/user-features-contract.test.cjs b/tests/widget-system/user-features-contract.test.cjs index 06b0ef70..03de8cb8 100644 --- a/tests/widget-system/user-features-contract.test.cjs +++ b/tests/widget-system/user-features-contract.test.cjs @@ -200,6 +200,7 @@ test('native user profile omits ledger tables and renders canonical images eager test('identity marker and profile are editable on the native profile while applications use the review queue', () => { const auth = read('src/User/AuthApply.php'); const verify = read('src/Admin/Native/UsersMenusVerify.php'); + const verifyDialogs = read('src/Admin/Native/UsersMenusVerifyDialogs.php'); const transitions = read('src/Identity/TransitionService.php'); assert.match(auth, /add_action\('edit_user_profile_update', \[\$this, 'save_admin_profile'\]\)/); @@ -214,9 +215,11 @@ test('identity marker and profile are editable on the native profile while appli assert.doesNotMatch(auth, /name="aksrt_identity_(?:application_uuid|type|status|public_name)"/); assert.match(verify, /'general',[\s\S]*?'manual'/); - assert.match(verify, /if \(\$status === 'manual_pending'\)/); - assert.match(verify, /'verified' => __\('通过申请'/); - assert.match(verify, /'rejected' => __\('拒绝申请'/); + assert.match(verify, /use UsersMenusVerifyDialogs;/); + assert.match(verifyDialogs, /\$pending = \$row\['status'\] === 'manual_pending'/); + assert.match(verifyDialogs, /if \(\$pending\) \{\s*echo '