From cc997f53e0bf0a31933267d099e4f8cd3cb9516e Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Thu, 5 Nov 2026 11:20:49 -0800 Subject: [PATCH] fix(ui): remove Log in from the hamburger menu The hamburger menu still offered Log in, a leftover from before the dashboard had its own sign-in. Mar's sidebar now carries a Log in card on Builds, Benchmarks and Performance Tests, so the menu item was a second, confusing way to sign in to Desktop that does not sign you in to ComfyUI. Remove the item, its click handler and isSignedInToCloud(), which only the menu used, plus the fileMenu.signIn strings. signInToCloud() stays: the sidebar card, the install wizard and the embedded session still use it. --- locales/en.json | 1 - locales/zh.json | 1 - .../lib/ipc/registerDevPlatformHandlers.ts | 6 -- src/main/popups/titlePopup.test.ts | 95 +------------------ src/main/popups/titlePopup.ts | 29 +----- 5 files changed, 6 insertions(+), 126 deletions(-) diff --git a/locales/en.json b/locales/en.json index cb04cba62..ce8a4869f 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1484,7 +1484,6 @@ "newInstall": "New Instance", "addExistingInstall": "Add Existing Instance", "loadSnapshot": "Load Snapshot", - "signIn": "Log in", "performanceTest": "Performance Tests", "benchmarks": "Benchmarks", "globalSettings": "Desktop Settings", diff --git a/locales/zh.json b/locales/zh.json index 14e1c8434..ef33be107 100644 --- a/locales/zh.json +++ b/locales/zh.json @@ -1484,7 +1484,6 @@ "newInstall": "新建实例", "addExistingInstall": "添加现有实例", "loadSnapshot": "加载快照", - "signIn": "登录", "performanceTest": "性能测试", "benchmarks": "基准比较", "globalSettings": "桌面端设置", diff --git a/src/main/lib/ipc/registerDevPlatformHandlers.ts b/src/main/lib/ipc/registerDevPlatformHandlers.ts index 5f19bcaae..707638487 100644 --- a/src/main/lib/ipc/registerDevPlatformHandlers.ts +++ b/src/main/lib/ipc/registerDevPlatformHandlers.ts @@ -187,12 +187,6 @@ export async function signOutOfCloud(host: ComfyWindowEntry | undefined): Promis return SIGNED_OUT } -/** Sign-in state for main-side surfaces that decide what to render (the file - * menu). Renderer surfaces read it over `getAuthStatus` instead. */ -export function isSignedInToCloud(): boolean { - return getCloudSession().status().signedIn -} - /** * Register the dev-platform IPC handlers. Call once at startup. * diff --git a/src/main/popups/titlePopup.test.ts b/src/main/popups/titlePopup.test.ts index 8ba1f98af..4a28b507c 100644 --- a/src/main/popups/titlePopup.test.ts +++ b/src/main/popups/titlePopup.test.ts @@ -1,17 +1,5 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest' -const devPlatformMocks = vi.hoisted(() => ({ - isSignedInToCloud: vi.fn(() => false), - signInToCloud: vi.fn(async () => ({ signedIn: true })) -})) - -// The file menu decides on sign-in state and starts sign-ins from main. Stub -// both so the menu tests drive that state directly instead of opening a browser. -vi.mock('../lib/ipc/registerDevPlatformHandlers', () => ({ - isSignedInToCloud: devPlatformMocks.isSignedInToCloud, - signInToCloud: devPlatformMocks.signInToCloud -})) - // shared.ts (via registry.ts) loads electron at import, so mock it first. vi.mock('electron', () => ({ app: { @@ -62,9 +50,6 @@ import * as settings from '../settings' beforeEach(() => { vi.clearAllMocks() - // Signed out is the default: every assertion that does not say otherwise - // describes a user who has not logged in yet. - devPlatformMocks.isSignedInToCloud.mockReturnValue(false) }) afterEach(() => { @@ -184,7 +169,7 @@ describe('buildTitlePopupMenuItems', () => { expect(quit?.label).toBe('Quit Desktop') }) - it('chooser host matches the canonical order, signed out', () => { + it('chooser host matches the canonical order', () => { const items = buildTitlePopupMenuItems(makeEntry({ installationId: null })) const ids = items.map((i) => i.id ?? null).filter((id) => id !== null) expect(ids).toEqual([ @@ -192,7 +177,6 @@ describe('buildTitlePopupMenuItems', () => { 'new-install', 'track', 'load-snapshot', - 'sign-in', 'performance-test', 'benchmarks', 'settings', @@ -200,9 +184,6 @@ describe('buildTitlePopupMenuItems', () => { 'exit-window', 'close-all-windows' ]) - const signIn = items.find((i) => i.id === 'sign-in') - expect(signIn?.label).toBe('Log in') - expect(signIn?.labelKey).toBe('fileMenu.signIn') }) it('install host matches the canonical order with Close Window between Send Feedback and Quit Desktop', () => { @@ -213,7 +194,6 @@ describe('buildTitlePopupMenuItems', () => { 'new-install', 'track', 'load-snapshot', - 'sign-in', 'performance-test', 'benchmarks', 'settings', @@ -227,25 +207,7 @@ describe('buildTitlePopupMenuItems', () => { expect(quit?.label).toBe('Quit Desktop') }) - it('chooser host matches the canonical order once signed in', () => { - devPlatformMocks.isSignedInToCloud.mockReturnValue(true) - const items = buildTitlePopupMenuItems(makeEntry({ installationId: null })) - const ids = items.map((i) => i.id ?? null).filter((id) => id !== null) - expect(ids).toEqual([ - 'new-window', - 'new-install', - 'track', - 'load-snapshot', - 'performance-test', - 'benchmarks', - 'settings', - 'feedback', - 'exit-window', - 'close-all-windows' - ]) - }) - - it('install host keeps Log in ahead of Reset Zoom when both are live', () => { + it('install host lists Reset Zoom after Send Feedback when zoomed', () => { const items = buildTitlePopupMenuItems(makeEntry({ installationId: 'inst-1', zoomLevel: 2 })) const ids = items.map((i) => i.id ?? null).filter((id) => id !== null) expect(ids).toEqual([ @@ -253,7 +215,6 @@ describe('buildTitlePopupMenuItems', () => { 'new-install', 'track', 'load-snapshot', - 'sign-in', 'performance-test', 'benchmarks', 'settings', @@ -264,15 +225,7 @@ describe('buildTitlePopupMenuItems', () => { ]) }) - // Login is the precondition for the account-scoped Comfy Developer Platform rollout, so - // it is never gated on that rollout — only on whether you are already in. - it('omits Log in once the user is signed in', () => { - devPlatformMocks.isSignedInToCloud.mockReturnValue(true) - const items = buildTitlePopupMenuItems(makeEntry({ installationId: null })) - expect(items.find((i) => i.id === 'sign-in')).toBeUndefined() - }) - - it('keeps the post-consent menu to Skip Onboarding, with no Log in item', () => { + it('keeps the post-consent menu to Skip Onboarding', () => { const items = buildTitlePopupMenuItems(makeEntry({ firstUseMode: 'post-consent' })) expect(items.map((i) => i.id ?? null)).toEqual(['skip-onboarding']) }) @@ -309,16 +262,7 @@ describe('buildTitlePopupMenuItems', () => { expect(ids[ids.length - 1]).toBe('close-all-windows') }) - it('separates Log in from the Performance Test and Benchmarks group', () => { - const items = buildTitlePopupMenuItems(makeEntry({ installationId: null })) - const signInIdx = items.findIndex((i) => i.id === 'sign-in') - expect(items[signInIdx + 1]?.kind).toBe('separator') - expect(items[signInIdx + 2]?.id).toBe('performance-test') - expect(items[signInIdx + 3]?.id).toBe('benchmarks') - }) - - it('does not leave a doubled separator above Performance Test once signed in', () => { - devPlatformMocks.isSignedInToCloud.mockReturnValue(true) + it('has a single separator above Performance Test', () => { const items = buildTitlePopupMenuItems(makeEntry({ installationId: null })) const performanceTestsIdx = items.findIndex((i) => i.id === 'performance-test') expect(items[performanceTestsIdx - 1]?.kind).toBe('separator') @@ -421,37 +365,6 @@ describe('activateTitlePopupMenuItem', () => { expect(bindings.resetComfyZoom).not.toHaveBeenCalled() }) - - // The shared primitive, not `session.login()` — it carries the sign-out race - // guard the `comfybuilder:signIn` IPC relies on. - it('routes Log in through the shared login primitive', () => { - const host = makeEntry({ installationId: null }) - comfyWindows.set(host.windowKey, host) - - activateTitlePopupMenuItem( - makePopupEntry(host.windowKey), - 'sign-in', - {} as unknown as TitlePopupHostBindings - ) - - expect(devPlatformMocks.signInToCloud).toHaveBeenCalledOnce() - }) - - it('swallows a cancelled or failed sign-in handoff', async () => { - const host = makeEntry({ installationId: null }) - comfyWindows.set(host.windowKey, host) - devPlatformMocks.signInToCloud.mockRejectedValueOnce(new Error('user closed the browser')) - - expect(() => - activateTitlePopupMenuItem( - makePopupEntry(host.windowKey), - 'sign-in', - {} as unknown as TitlePopupHostBindings - ) - ).not.toThrow() - // Let the rejected promise settle so an unhandled rejection would surface. - await Promise.resolve() - }) }) describe('decideFlowMenuItemTarget', () => { diff --git a/src/main/popups/titlePopup.ts b/src/main/popups/titlePopup.ts index d3bb21c41..086731bd6 100644 --- a/src/main/popups/titlePopup.ts +++ b/src/main/popups/titlePopup.ts @@ -35,7 +35,6 @@ import { buildModelsPayload, buildInstallLocationFields } from '../lib/ipc/registerSettingsHandlers' -import { isSignedInToCloud, signInToCloud } from '../lib/ipc/registerDevPlatformHandlers' import { globalSettingsEvents } from '../lib/globalSettingsEvents' import * as installations from '../installations' import { getCachedGithubStarCount, getGithubStarCount } from '../lib/githubStars' @@ -759,7 +758,6 @@ export function buildTitlePopupMenuItems(entry: ComfyWindowEntry): TitlePopupMen // Add Existing Install // Load Snapshot // ── separator ── - // (Log in — while signed out, followed by its own separator) // Performance Test // Benchmarks // ── separator ── @@ -786,12 +784,6 @@ export function buildTitlePopupMenuItems(entry: ComfyWindowEntry): TitlePopupMen // - "Return to Dashboard" is absent: the picker's Home icon is // the canonical dashboard escape (opens a fresh chooser window // instead of detaching, so the running ComfyUI stays alive). - // - "Log in" sits in its own group above Desktop Settings while - // signed out, and is the app's ONLY sign-in affordance. Deliberately - // NOT behind the Comfy Developer Platform rollout flag: that flag gates - // what a signed-in account may do, and gating login itself - // would put it behind a decision that cannot be made until the - // user has logged in. const items: TitlePopupMenuItem[] = [ { id: 'new-window', label: 'Open Dashboard', labelKey: 'fileMenu.newWindow' }, { kind: 'separator' }, @@ -802,15 +794,7 @@ export function buildTitlePopupMenuItems(entry: ComfyWindowEntry): TitlePopupMen labelKey: 'fileMenu.addExistingInstall' }, { id: 'load-snapshot', label: 'Load Snapshot', labelKey: 'fileMenu.loadSnapshot' }, - { kind: 'separator' } - ] - if (!isSignedInToCloud()) { - items.push( - { id: 'sign-in', label: 'Log in', labelKey: 'fileMenu.signIn' }, - { kind: 'separator' } - ) - } - items.push( + { kind: 'separator' }, { id: 'performance-test', label: 'Performance Tests', @@ -824,7 +808,7 @@ export function buildTitlePopupMenuItems(entry: ComfyWindowEntry): TitlePopupMen labelKey: 'fileMenu.globalSettings' }, { id: 'feedback', label: 'Send Beta Feedback', labelKey: 'fileMenu.sendFeedback' } - ) + ] // Reset Zoom — discoverable recovery path for users who zoom the live // ComfyUI view too far to read. Dashboard hosts do not expose zoom controls. if (entry.installationId !== null && !entry.comfyView.webContents.isDestroyed()) { @@ -2058,15 +2042,6 @@ export function activateTitlePopupMenuItem( // via `comfy-window:click-feedback`; `source` distinguishes the // two entry points in the telemetry payload. bindings.triggerOpenFeedback(entry.parentEntryId, 'menu') - } else if (id === 'sign-in') { - // No renderer in this loop — the popup is its own WebContentsView — so the - // menu calls the same primitive `comfybuilder:signIn` does, which is what - // keeps the sign-out race guard shared instead of forked. Fire-and-forget: - // the browser handoff can take minutes and every surface repaints off the - // `authChanged` broadcast the primitive sends, not off this call. - void signInToCloud().catch(() => { - // Cancelled or failed handoff: the menu item re-arms on the next open. - }) } else if (id === 'reset-zoom') { // Route through the shared reset so the title-bar pill picks up the // `comfy-titlebar:zoom-changed` push (that event fires only for