Skip to content

Commit d6f6407

Browse files
authored
[System Pop Up] Add setting to disable version update notifications (#4388)
1 parent 2906ea3 commit d6f6407

File tree

7 files changed

+441
-5
lines changed

7 files changed

+441
-5
lines changed

browser_tests/tests/releaseNotifications.spec.ts

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,239 @@ test.describe('Release Notifications', () => {
130130
whatsNewSection.locator('text=No recent releases')
131131
).toBeVisible()
132132
})
133+
134+
test('should hide "What\'s New" section when notifications are disabled', async ({
135+
comfyPage
136+
}) => {
137+
// Disable version update notifications
138+
await comfyPage.setSetting('Comfy.Notification.ShowVersionUpdates', false)
139+
140+
// Mock release API with test data
141+
await comfyPage.page.route('**/releases**', async (route) => {
142+
const url = route.request().url()
143+
if (
144+
url.includes('api.comfy.org') ||
145+
url.includes('stagingapi.comfy.org')
146+
) {
147+
await route.fulfill({
148+
status: 200,
149+
contentType: 'application/json',
150+
body: JSON.stringify([
151+
{
152+
id: 1,
153+
project: 'comfyui',
154+
version: 'v0.3.44',
155+
attention: 'high',
156+
content: '## New Features\n\n- Added awesome feature',
157+
published_at: new Date().toISOString()
158+
}
159+
])
160+
})
161+
} else {
162+
await route.continue()
163+
}
164+
})
165+
166+
await comfyPage.setup({ mockReleases: false })
167+
168+
// Open help center
169+
const helpCenterButton = comfyPage.page.locator('.comfy-help-center-btn')
170+
await helpCenterButton.waitFor({ state: 'visible' })
171+
await helpCenterButton.click()
172+
173+
// Verify help center menu appears
174+
const helpMenu = comfyPage.page.locator('.help-center-menu')
175+
await expect(helpMenu).toBeVisible()
176+
177+
// Verify "What's New?" section is hidden
178+
const whatsNewSection = comfyPage.page.locator('.whats-new-section')
179+
await expect(whatsNewSection).not.toBeVisible()
180+
181+
// Should not show any popups or toasts
182+
await expect(comfyPage.page.locator('.whats-new-popup')).not.toBeVisible()
183+
await expect(
184+
comfyPage.page.locator('.release-notification-toast')
185+
).not.toBeVisible()
186+
})
187+
188+
test('should not make API calls when notifications are disabled', async ({
189+
comfyPage
190+
}) => {
191+
// Disable version update notifications
192+
await comfyPage.setSetting('Comfy.Notification.ShowVersionUpdates', false)
193+
194+
// Track API calls
195+
let apiCallCount = 0
196+
await comfyPage.page.route('**/releases**', async (route) => {
197+
const url = route.request().url()
198+
if (
199+
url.includes('api.comfy.org') ||
200+
url.includes('stagingapi.comfy.org')
201+
) {
202+
apiCallCount++
203+
await route.fulfill({
204+
status: 200,
205+
contentType: 'application/json',
206+
body: JSON.stringify([])
207+
})
208+
} else {
209+
await route.continue()
210+
}
211+
})
212+
213+
await comfyPage.setup({ mockReleases: false })
214+
215+
// Wait a bit to ensure any potential API calls would have been made
216+
await comfyPage.page.waitForTimeout(1000)
217+
218+
// Verify no API calls were made
219+
expect(apiCallCount).toBe(0)
220+
})
221+
222+
test('should show "What\'s New" section when notifications are enabled', async ({
223+
comfyPage
224+
}) => {
225+
// Enable version update notifications (default behavior)
226+
await comfyPage.setSetting('Comfy.Notification.ShowVersionUpdates', true)
227+
228+
// Mock release API with test data
229+
await comfyPage.page.route('**/releases**', async (route) => {
230+
const url = route.request().url()
231+
if (
232+
url.includes('api.comfy.org') ||
233+
url.includes('stagingapi.comfy.org')
234+
) {
235+
await route.fulfill({
236+
status: 200,
237+
contentType: 'application/json',
238+
body: JSON.stringify([
239+
{
240+
id: 1,
241+
project: 'comfyui',
242+
version: 'v0.3.44',
243+
attention: 'medium',
244+
content: '## New Features\n\n- Added awesome feature',
245+
published_at: new Date().toISOString()
246+
}
247+
])
248+
})
249+
} else {
250+
await route.continue()
251+
}
252+
})
253+
254+
await comfyPage.setup({ mockReleases: false })
255+
256+
// Open help center
257+
const helpCenterButton = comfyPage.page.locator('.comfy-help-center-btn')
258+
await helpCenterButton.waitFor({ state: 'visible' })
259+
await helpCenterButton.click()
260+
261+
// Verify help center menu appears
262+
const helpMenu = comfyPage.page.locator('.help-center-menu')
263+
await expect(helpMenu).toBeVisible()
264+
265+
// Verify "What's New?" section is visible
266+
const whatsNewSection = comfyPage.page.locator('.whats-new-section')
267+
await expect(whatsNewSection).toBeVisible()
268+
269+
// Should show the release
270+
await expect(
271+
whatsNewSection.locator('text=Comfy v0.3.44 Release')
272+
).toBeVisible()
273+
})
274+
275+
test('should toggle "What\'s New" section when setting changes', async ({
276+
comfyPage
277+
}) => {
278+
// Mock release API with test data
279+
await comfyPage.page.route('**/releases**', async (route) => {
280+
const url = route.request().url()
281+
if (
282+
url.includes('api.comfy.org') ||
283+
url.includes('stagingapi.comfy.org')
284+
) {
285+
await route.fulfill({
286+
status: 200,
287+
contentType: 'application/json',
288+
body: JSON.stringify([
289+
{
290+
id: 1,
291+
project: 'comfyui',
292+
version: 'v0.3.44',
293+
attention: 'low',
294+
content: '## Bug Fixes\n\n- Fixed minor issue',
295+
published_at: new Date().toISOString()
296+
}
297+
])
298+
})
299+
} else {
300+
await route.continue()
301+
}
302+
})
303+
304+
// Start with notifications enabled
305+
await comfyPage.setSetting('Comfy.Notification.ShowVersionUpdates', true)
306+
await comfyPage.setup({ mockReleases: false })
307+
308+
// Open help center
309+
const helpCenterButton = comfyPage.page.locator('.comfy-help-center-btn')
310+
await helpCenterButton.waitFor({ state: 'visible' })
311+
await helpCenterButton.click()
312+
313+
// Verify "What's New?" section is visible
314+
const whatsNewSection = comfyPage.page.locator('.whats-new-section')
315+
await expect(whatsNewSection).toBeVisible()
316+
317+
// Close help center
318+
await comfyPage.page.click('.help-center-backdrop')
319+
320+
// Disable notifications
321+
await comfyPage.setSetting('Comfy.Notification.ShowVersionUpdates', false)
322+
323+
// Reopen help center
324+
await helpCenterButton.click()
325+
326+
// Verify "What's New?" section is now hidden
327+
await expect(whatsNewSection).not.toBeVisible()
328+
})
329+
330+
test('should handle edge case with empty releases and disabled notifications', async ({
331+
comfyPage
332+
}) => {
333+
// Disable notifications
334+
await comfyPage.setSetting('Comfy.Notification.ShowVersionUpdates', false)
335+
336+
// Mock empty releases
337+
await comfyPage.page.route('**/releases**', async (route) => {
338+
const url = route.request().url()
339+
if (
340+
url.includes('api.comfy.org') ||
341+
url.includes('stagingapi.comfy.org')
342+
) {
343+
await route.fulfill({
344+
status: 200,
345+
contentType: 'application/json',
346+
body: JSON.stringify([])
347+
})
348+
} else {
349+
await route.continue()
350+
}
351+
})
352+
353+
await comfyPage.setup({ mockReleases: false })
354+
355+
// Open help center
356+
const helpCenterButton = comfyPage.page.locator('.comfy-help-center-btn')
357+
await helpCenterButton.waitFor({ state: 'visible' })
358+
await helpCenterButton.click()
359+
360+
// Verify help center still works
361+
const helpMenu = comfyPage.page.locator('.help-center-menu')
362+
await expect(helpMenu).toBeVisible()
363+
364+
// Section should be hidden regardless of empty releases
365+
const whatsNewSection = comfyPage.page.locator('.whats-new-section')
366+
await expect(whatsNewSection).not.toBeVisible()
367+
})
133368
})

src/components/helpcenter/HelpCenterMenuContent.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
</Teleport>
5555

5656
<!-- What's New Section -->
57-
<section class="whats-new-section">
57+
<section v-if="showVersionUpdates" class="whats-new-section">
5858
<h3 class="section-description">{{ $t('helpCenter.whatsNew') }}</h3>
5959

6060
<!-- Release Items -->
@@ -126,6 +126,7 @@ import { useI18n } from 'vue-i18n'
126126
import { type ReleaseNote } from '@/services/releaseService'
127127
import { useCommandStore } from '@/stores/commandStore'
128128
import { useReleaseStore } from '@/stores/releaseStore'
129+
import { useSettingStore } from '@/stores/settingStore'
129130
import { electronAPI, isElectron } from '@/utils/envUtil'
130131
import { formatVersionAnchor } from '@/utils/formatUtil'
131132
@@ -168,6 +169,7 @@ const SUBMENU_CONFIG = {
168169
const { t, locale } = useI18n()
169170
const releaseStore = useReleaseStore()
170171
const commandStore = useCommandStore()
172+
const settingStore = useSettingStore()
171173
172174
// Emits
173175
const emit = defineEmits<{
@@ -182,6 +184,9 @@ let hoverTimeout: number | null = null
182184
183185
// Computed
184186
const hasReleases = computed(() => releaseStore.releases.length > 0)
187+
const showVersionUpdates = computed(() =>
188+
settingStore.get('Comfy.Notification.ShowVersionUpdates')
189+
)
185190
186191
const moreMenuItem = computed(() =>
187192
menuItems.value.find((item) => item.key === 'more')

src/constants/coreSettings.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,14 @@ export const CORE_SETTINGS: SettingParams[] = [
330330
defaultValue: true,
331331
versionAdded: '1.20.3'
332332
},
333+
{
334+
id: 'Comfy.Notification.ShowVersionUpdates',
335+
category: ['Comfy', 'Notification Preferences'],
336+
name: 'Show version updates',
337+
tooltip: 'Show updates for new models, and major new features.',
338+
type: 'boolean',
339+
defaultValue: true
340+
},
333341
{
334342
id: 'Comfy.ConfirmClear',
335343
category: ['Comfy', 'Workflow', 'ConfirmClear'],

src/locales/en/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@
232232
"Comfy_NodeBadge_ShowApiPricing": {
233233
"name": "Show API node pricing badge"
234234
},
235+
"Comfy_Notification_ShowVersionUpdates": {
236+
"name": "Show version updates",
237+
"tooltip": "Show updates for new models, and major new features."
238+
},
235239
"Comfy_NodeSearchBoxImpl": {
236240
"name": "Node search box implementation",
237241
"options": {

src/schemas/apiSchema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ const zSettings = z.object({
426426
'Comfy.NodeBadge.NodeIdBadgeMode': zNodeBadgeMode,
427427
'Comfy.NodeBadge.NodeLifeCycleBadgeMode': zNodeBadgeMode,
428428
'Comfy.NodeBadge.ShowApiPricing': z.boolean(),
429+
'Comfy.Notification.ShowVersionUpdates': z.boolean(),
429430
'Comfy.QueueButton.BatchCountLimit': z.number(),
430431
'Comfy.Queue.MaxHistoryItems': z.number(),
431432
'Comfy.Keybinding.UnsetBindings': z.array(zKeybinding),

src/stores/releaseStore.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export const useReleaseStore = defineStore('release', () => {
3232
const releaseTimestamp = computed(() =>
3333
settingStore.get('Comfy.Release.Timestamp')
3434
)
35+
const showVersionUpdates = computed(() =>
36+
settingStore.get('Comfy.Notification.ShowVersionUpdates')
37+
)
3538

3639
// Most recent release
3740
const recentRelease = computed(() => {
@@ -73,6 +76,11 @@ export const useReleaseStore = defineStore('release', () => {
7376

7477
// Show toast if needed
7578
const shouldShowToast = computed(() => {
79+
// Skip if notifications are disabled
80+
if (!showVersionUpdates.value) {
81+
return false
82+
}
83+
7684
if (!isNewVersionAvailable.value) {
7785
return false
7886
}
@@ -85,7 +93,7 @@ export const useReleaseStore = defineStore('release', () => {
8593
// Skip if user already skipped or changelog seen
8694
if (
8795
releaseVersion.value === recentRelease.value?.version &&
88-
!['skipped', 'changelog seen'].includes(releaseStatus.value)
96+
['skipped', 'changelog seen'].includes(releaseStatus.value)
8997
) {
9098
return false
9199
}
@@ -95,6 +103,11 @@ export const useReleaseStore = defineStore('release', () => {
95103

96104
// Show red-dot indicator
97105
const shouldShowRedDot = computed(() => {
106+
// Skip if notifications are disabled
107+
if (!showVersionUpdates.value) {
108+
return false
109+
}
110+
98111
// Already latest → no dot
99112
if (!isNewVersionAvailable.value) {
100113
return false
@@ -132,6 +145,11 @@ export const useReleaseStore = defineStore('release', () => {
132145

133146
// Show "What's New" popup
134147
const shouldShowPopup = computed(() => {
148+
// Skip if notifications are disabled
149+
if (!showVersionUpdates.value) {
150+
return false
151+
}
152+
135153
if (!isLatestVersion.value) {
136154
return false
137155
}
@@ -183,7 +201,14 @@ export const useReleaseStore = defineStore('release', () => {
183201

184202
// Fetch releases from API
185203
async function fetchReleases(): Promise<void> {
186-
if (isLoading.value) return
204+
if (isLoading.value) {
205+
return
206+
}
207+
208+
// Skip fetching if notifications are disabled
209+
if (!showVersionUpdates.value) {
210+
return
211+
}
187212

188213
isLoading.value = true
189214
error.value = null

0 commit comments

Comments
 (0)