fix(profile): align account dialogs and contracts

This commit is contained in:
2026-10-06 01:09:04 +08:00
parent f646fa8573
commit 248912f610
17 changed files with 1339 additions and 832 deletions
@@ -198,27 +198,31 @@ test('native user profile omits ledger tables and renders canonical images eager
assert.doesNotMatch(level, /Level::get_badge_html/);
});
test('identity status, type, and name are directly editable on the native profile', () => {
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 transitions = read('src/Identity/TransitionService.php');
assert.match(auth, /add_action\('edit_user_profile_update', \[\$this, 'handle_admin_profile_update'\]\)/);
assert.match(auth, /add_action\('edit_user_profile_update', \[\$this, 'save_admin_profile'\]\)/);
assert.match(auth, /current_user_can\('aksrt_review_identity'\)/);
assert.match(auth, /wp_nonce_field\('aksrt_identity_profile_' \.[\s\S]*?'aksrt_identity_profile_nonce'\)/);
assert.match(auth, /name="aksrt_identity_application_uuid"/);
assert.match(auth, /name="aksrt_identity_type"/);
assert.match(auth, /value="personal"[\s\S]*?个人认证/);
assert.match(auth, /value="enterprise"[\s\S]*?企业认证/);
assert.match(auth, /name="aksrt_identity_public_name"/);
assert.match(auth, /姓名 \/ 主体全称/);
assert.match(auth, /name="aksrt_identity_status"/);
assert.match(auth, /'manual_pending' => __\('待审核'/);
assert.match(auth, /'verified' => __\('已认证'/);
assert.match(auth, /'rejected' => __\('已驳回'/);
assert.match(auth, /create_admin_application\(\$repo, \$user_id, \$fields\)/);
assert.match(auth, /'type' => \$fields\['type'\]/);
assert.match(auth, /self::review\(\$user_id, \$application_uuid, \$target_status, \$note, get_current_user_id\(\), \$fields\)/);
assert.match(transitions, /public function admin_transition/);
assert.match(transitions, /\? in_array\(\$next, \['manual_pending', 'verified', 'rejected', 'cancelled'\], true\)/);
assert.match(transitions, /'verified' => \['cancelled'\]/);
assert.match(auth, /wp_nonce_field\('aksrt_auth_profile_' \.[\s\S]*?'aksrt_auth_profile_nonce'\)/);
assert.match(auth, /name="aksrt_auth_enabled"/);
assert.match(auth, /name="aksrt_auth_name"/);
assert.match(auth, /name="aksrt_auth_desc"/);
assert.match(auth, /name="aksrt_auth_time"/);
assert.match(auth, /update_user_meta\(\$user_id, 'auth', 1\)/);
assert.match(auth, /update_user_meta\(\$user_id, 'auth_info'/);
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, /AuthApply::review\(\$user_id, \$uuid, \$status, \$note, get_current_user_id\(\), \$fields\)/);
assert.match(auth, /\['verified', 'rejected'\]/);
assert.match(auth, /\(string\) \$application\['status'\] !== 'manual_pending'/);
assert.match(transitions, /'manual_pending' => 'pending'/);
assert.match(transitions, /'verified' => 'verified'/);
assert.match(transitions, /'rejected' => 'rejected'/);
assert.match(transitions, /default => ''/);
});