Merge branch 'codex/wechat-nickname'

This commit is contained in:
2026-06-06 23:59:30 +08:00
15 changed files with 431 additions and 58 deletions

View File

@@ -177,6 +177,23 @@ test('account panel uses compact binding cards and keeps logout actions at the b
).toBe('true');
});
test('account panel avoids bare bound label when wechat display name is missing', () => {
renderAccountModal({
entryMode: 'account',
user: {
...baseUser,
wechatDisplayName: null,
wechatAccount: 'openid_abcdef123456',
},
});
const accountDialog = screen.getByRole('dialog', { name: '账号信息' });
expect(within(accountDialog).getByText('绑定微信')).toBeTruthy();
expect(within(accountDialog).getByText('微信账号尾号 123456')).toBeTruthy();
expect(within(accountDialog).queryByText('openid_abcdef123456')).toBeNull();
expect(within(accountDialog).queryByText('已绑定')).toBeNull();
});
test('account actions open in independent panels instead of inline expansion', async () => {
const user = userEvent.setup();

View File

@@ -109,6 +109,15 @@ function formatSessionTime(value: string) {
});
}
function formatBoundWechatAccount(value: string | null | undefined) {
const normalized = value?.trim();
if (!normalized) {
return null;
}
return `微信账号尾号 ${normalized.slice(-6)}`;
}
function SettingsEntryCard({
label,
detail,
@@ -444,7 +453,9 @@ export function AccountModal({
const boundPhoneNumber =
user.phoneNumber?.trim() || user.phoneNumberMasked || '未绑定';
const boundWechatDisplayName =
user.wechatDisplayName?.trim() || (user.wechatBound ? '已绑定' : '未绑定');
user.wechatDisplayName?.trim() ||
formatBoundWechatAccount(user.wechatAccount) ||
(user.wechatBound ? '微信账号已绑定' : '未绑定');
const sectionSummaries: Record<PrimarySettingsSection, string> = {
appearance: