Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 未登录时账户菜单显示登录 (#3973)

Dash2051f6ba68f5
diff --git a/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts b/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
index b6435b9f09..526d7c76f1 100644
--- a/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
+++ b/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
@@ -228,7 +228,7 @@ describe('UserInfoSection — inner main button no longer owns hover background'
expect(source).not.toContain('useLogout');
expect(source).not.toContain('<LogOut');
expect(source).toContain("mode === 'local'");
- expect(source.indexOf("t('sidebar.user.menuAddAccount')")).toBeLessThan(
+ expect(source.indexOf("t('login.signIn')")).toBeLessThan(
source.indexOf("t('sidebar.user.menuSettings')"),
);
expect(source).not.toContain('AccountSwitcherDialog');
diff --git a/apps/desktop/src/renderer/__tests__/userInfoSectionMobileDownload.test.tsx b/apps/desktop/src/renderer/__tests__/userInfoSectionMobileDownload.test.tsx
index 9d4eeacb77..fe844e7451 100644
--- a/apps/desktop/src/renderer/__tests__/userInfoSectionMobileDownload.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/userInfoSectionMobileDownload.test.tsx
@@ -275,7 +275,7 @@ describe('UserInfoSection mobile download entry', () => {
expect(screen.queryByRole('menuitem', { name: /Cindy user/ })).toBeNull();
});
- it('keeps the add-account entry before Settings when the user is not signed in', async () => {
+ it('keeps the sign-in entry before Settings when the user is not signed in', async () => {
authState.user = null;
authState.mode = 'local';
@@ -285,16 +285,16 @@ describe('UserInfoSection mobile download entry', () => {
ctrlKey: false,
});
- const addAccount = await screen.findByRole('menuitem', {
- name: 'sidebar.user.menuAddAccount',
+ const signIn = await screen.findByRole('menuitem', {
+ name: 'login.signIn',
});
const settings = screen.getByRole('menuitem', { name: 'sidebar.user.menuSettings' });
- expect(addAccount.compareDocumentPosition(settings) & Node.DOCUMENT_POSITION_FOLLOWING).toBe(
+ expect(signIn.compareDocumentPosition(settings) & Node.DOCUMENT_POSITION_FOLLOWING).toBe(
Node.DOCUMENT_POSITION_FOLLOWING,
);
expect(listAccounts).not.toHaveBeenCalled();
- fireEvent.click(addAccount);
+ fireEvent.click(signIn);
await waitFor(() =>
expect(navigate).toHaveBeenCalledWith('/add-account', { state: { returnTo: '/' } }),
);
diff --git a/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx b/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
index 754e1bec39..c74468f492 100644
--- a/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
+++ b/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
@@ -284,7 +284,7 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec
{mode === 'local' ? (
<DropdownMenuItem onSelect={() => void openAddAccount()} className="gap-2.5">
<UserPlus className="h-4 w-4" aria-hidden="true" />
- {t('sidebar.user.menuAddAccount')}
+ {t('login.signIn')}
</DropdownMenuItem>
) : null}
<DropdownMenuItem onSelect={openSettings} className="gap-2.5">