From 3eb4bae9ab4849a9554e17ad717823f1c63a0a8d Mon Sep 17 00:00:00 2001 From: "chihao.ou" Date: Tue, 22 Sep 2026 21:49:27 +0800 Subject: [PATCH] fix(profile): recognize DingTalk profile sources --- .../components/user/profile/ProfileInfoCard.vue | 1 + .../user/profile/__tests__/ProfileInfoCard.spec.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/frontend/src/components/user/profile/ProfileInfoCard.vue b/frontend/src/components/user/profile/ProfileInfoCard.vue index fc5691a86f..6783f6d8ab 100644 --- a/frontend/src/components/user/profile/ProfileInfoCard.vue +++ b/frontend/src/components/user/profile/ProfileInfoCard.vue @@ -281,6 +281,7 @@ function normalizeProvider(value: string): UserAuthProvider | null { if ( normalized === 'email' || normalized === 'linuxdo' || + normalized === 'dingtalk' || normalized === 'wechat' || normalized === 'github' || normalized === 'google' diff --git a/frontend/src/components/user/profile/__tests__/ProfileInfoCard.spec.ts b/frontend/src/components/user/profile/__tests__/ProfileInfoCard.spec.ts index 51653c6a4a..e8ee136282 100644 --- a/frontend/src/components/user/profile/__tests__/ProfileInfoCard.spec.ts +++ b/frontend/src/components/user/profile/__tests__/ProfileInfoCard.spec.ts @@ -35,6 +35,7 @@ vi.mock('vue-i18n', async (importOriginal) => { if (key === 'profile.user') return 'User' if (key === 'profile.authBindings.providers.email') return 'Email' if (key === 'profile.authBindings.providers.linuxdo') return 'LinuxDo' + if (key === 'profile.authBindings.providers.dingtalk') return 'DingTalk' if (key === 'profile.authBindings.providers.wechat') return 'WeChat' if (key === 'profile.authBindings.providers.oidc') return params?.providerName || 'OIDC' if (key === 'profile.authBindings.source.avatar') { @@ -70,6 +71,19 @@ function createUser(overrides: Partial = {}): User { } describe('ProfileInfoCard', () => { + it.each([ + { avatar_source: 'dingtalk', username_source: 'dingtalk' }, + { profile_sources: { avatar: { provider: 'dingtalk' }, username: { provider: 'dingtalk' } } }, + ])('shows DingTalk as the synchronized profile source', (sources) => { + const wrapper = mount(ProfileInfoCard, { + props: { user: createUser(sources), dingtalkEnabled: true }, + global: { stubs: { Icon: true } }, + }) + expect(wrapper.text()).toContain('Avatar synced from DingTalk') + expect(wrapper.text()).toContain('Username synced from DingTalk') + wrapper.unmount() + }) + it('renders basic account information inside the new overview shell', () => { const wrapper = mount(ProfileInfoCard, { props: {