From 7c9951c330e7472e8f6fdd7bf0183881423d748e Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Thu, 18 Dec 2025 17:44:14 -0800 Subject: [PATCH] Disable desktop release notifications --- src/platform/updates/common/releaseStore.ts | 10 +++--- tests-ui/tests/store/releaseStore.test.ts | 36 ++++++++++++--------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/platform/updates/common/releaseStore.ts b/src/platform/updates/common/releaseStore.ts index 80c2bc05d..9de4e576e 100644 --- a/src/platform/updates/common/releaseStore.ts +++ b/src/platform/updates/common/releaseStore.ts @@ -94,8 +94,9 @@ export const useReleaseStore = defineStore('release', () => { // Show toast if needed const shouldShowToast = computed(() => { - // Only show on desktop version - if (!isElectron() || isCloud) { + // Disable on desktop; updates are handled by todesktop + // Disable on cloud; users do not update cloud + if (isElectron() || isCloud) { return false } @@ -126,8 +127,9 @@ export const useReleaseStore = defineStore('release', () => { // Show red-dot indicator const shouldShowRedDot = computed(() => { - // Only show on desktop version - if (!isElectron() || isCloud) { + // Disable on desktop; updates are handled by todesktop + // Disable on cloud; users do not update cloud + if (isElectron() || isCloud) { return false } diff --git a/tests-ui/tests/store/releaseStore.test.ts b/tests-ui/tests/store/releaseStore.test.ts index 1d99cc381..c4bd8f06d 100644 --- a/tests-ui/tests/store/releaseStore.test.ts +++ b/tests-ui/tests/store/releaseStore.test.ts @@ -71,7 +71,7 @@ describe('useReleaseStore', () => { vi.mocked(useReleaseService).mockReturnValue(mockReleaseService) vi.mocked(useSettingStore).mockReturnValue(mockSettingStore) vi.mocked(useSystemStatsStore).mockReturnValue(mockSystemStatsStore) - vi.mocked(isElectron).mockReturnValue(true) + vi.mocked(isElectron).mockReturnValue(false) vi.mocked(valid).mockReturnValue('1.0.0') // Default showVersionUpdates to true @@ -170,11 +170,14 @@ describe('useReleaseStore', () => { expect(store.shouldShowRedDot).toBe(true) }) - it('should show popup for latest version', () => { + it('should show popup for latest version', async () => { mockSystemStatsStore.systemStats.system.comfyui_version = '1.2.0' vi.mocked(compare).mockReturnValue(0) + const { isElectron } = await import('@/utils/envUtil') + vi.mocked(isElectron).mockReturnValue(true) + expect(store.shouldShowPopup).toBe(true) }) @@ -514,7 +517,7 @@ describe('useReleaseStore', () => { expect(store.shouldShowRedDot).toBe(true) }) - it('should show popup for latest version', () => { + it('should show popup for latest version', async () => { mockSystemStatsStore.systemStats.system.comfyui_version = '1.2.0' // Same as release mockSettingStore.get.mockImplementation((key: string) => { if (key === 'Comfy.Notification.ShowVersionUpdates') return true @@ -523,6 +526,9 @@ describe('useReleaseStore', () => { vi.mocked(compare).mockReturnValue(0) // versions are equal (latest version) + const { isElectron } = await import('@/utils/envUtil') + vi.mocked(isElectron).mockReturnValue(true) + store.releases = [mockRelease] expect(store.shouldShowPopup).toBe(true) @@ -578,17 +584,17 @@ describe('useReleaseStore', () => { vi.mocked(isElectron).mockReturnValue(true) }) - it('should show toast when conditions are met', () => { + it('should not show toast when conditions are met', () => { vi.mocked(compare).mockReturnValue(1) store.releases = [mockRelease] - expect(store.shouldShowToast).toBe(true) + expect(store.shouldShowToast).toBe(false) }) - it('should show red dot when new version available', () => { + it('should not show red dot when new version available', () => { vi.mocked(compare).mockReturnValue(1) - expect(store.shouldShowRedDot).toBe(true) + expect(store.shouldShowRedDot).toBe(false) }) it('should show popup for latest version', () => { @@ -606,22 +612,22 @@ describe('useReleaseStore', () => { vi.mocked(isElectron).mockReturnValue(false) }) - it('should NOT show toast even when all other conditions are met', () => { + it('should show toast when all other conditions are met', () => { vi.mocked(compare).mockReturnValue(1) // Set up all conditions that would normally show toast store.releases = [mockRelease] - expect(store.shouldShowToast).toBe(false) + expect(store.shouldShowToast).toBe(true) }) - it('should NOT show red dot even when new version available', () => { + it('should show red dot when new version available', () => { vi.mocked(compare).mockReturnValue(1) - expect(store.shouldShowRedDot).toBe(false) + expect(store.shouldShowRedDot).toBe(true) }) - it('should NOT show toast regardless of attention level', () => { + it('should show toast for medium/high attention releases', () => { vi.mocked(compare).mockReturnValue(1) // Test with high attention releases @@ -637,15 +643,15 @@ describe('useReleaseStore', () => { } store.releases = [highRelease, mediumRelease] - expect(store.shouldShowToast).toBe(false) + expect(store.shouldShowToast).toBe(true) }) - it('should NOT show red dot even with high attention release', () => { + it('should show red dot with high attention release', () => { vi.mocked(compare).mockReturnValue(1) store.releases = [{ ...mockRelease, attention: 'high' as const }] - expect(store.shouldShowRedDot).toBe(false) + expect(store.shouldShowRedDot).toBe(true) }) it('should NOT show popup even for latest version', () => {