fix: preserve focused notification suppression default (#5550)

This commit is contained in:
Jinjing
2026-06-16 18:05:39 -07:00
committed by GitHub
parent 9885ff9760
commit 72ec39bcc0
6 changed files with 47 additions and 14 deletions
+1
View File
@@ -435,6 +435,7 @@ describe('Store', () => {
expect(settings.floatingTerminalDefaultedForAllUsers).toBe(true)
expect(settings.notifications.customSoundPath).toBeNull()
expect(settings.notifications.customSoundVolume).toBe(100)
expect(settings.notifications.suppressWhenFocused).toBe(true)
})
it('returns default UI state when no data file exists', async () => {
@@ -11,7 +11,7 @@ function createSettings(
enabled: true,
agentTaskComplete: true,
terminalBell: true,
suppressWhenFocused: false,
suppressWhenFocused: true,
customSoundId: 'system',
customSoundPath: null,
customSoundVolume: 80,
@@ -17,12 +17,6 @@ import { getNotificationSoundOptions } from '@/components/notification-sound-opt
import { useMountedRef } from '@/hooks/useMountedRef'
import { translate } from '@/i18n/i18n'
export type NotificationDraft = {
agentTaskComplete: boolean
terminalBell: boolean
notifyWhenFocused: boolean
}
type NotificationStepProps = {
settings: GlobalSettings | null
updateSettings: (updates: Partial<GlobalSettings>) => Promise<void> | void
@@ -7,6 +7,7 @@ vi.mock('@/lib/telemetry', () => ({
}))
import {
buildCompletedOnboardingNotificationSettings,
buildOnboardingDismissedPayload,
trackOnboardingDismissed
} from './use-onboarding-flow-persistence'
@@ -41,4 +42,26 @@ describe('onboarding flow persistence', () => {
advanced_via: 'keyboard'
})
})
it('preserves explicit focus notification suppression when completing onboarding', () => {
const notifications = buildCompletedOnboardingNotificationSettings({
enabled: false,
agentTaskComplete: false,
terminalBell: false,
suppressWhenFocused: false,
customSoundId: 'two-tone',
customSoundPath: null,
customSoundVolume: 60
})
expect(notifications).toEqual({
enabled: true,
agentTaskComplete: true,
terminalBell: true,
suppressWhenFocused: false,
customSoundId: 'two-tone',
customSoundPath: null,
customSoundVolume: 60
})
})
})
@@ -22,6 +22,17 @@ function selectedAgentOrBlank(agent: TuiAgent | null): TuiAgent | 'blank' {
return agent ?? 'blank'
}
export function buildCompletedOnboardingNotificationSettings(
notifications: GlobalSettings['notifications']
): GlobalSettings['notifications'] {
return {
...notifications,
enabled: true,
agentTaskComplete: true,
terminalBell: true
}
}
type CloseWithDeps = {
onOnboardingChange: (state: OnboardingState) => void
onboardingChecklist: OnboardingState['checklist']
@@ -188,12 +199,7 @@ export function usePersistCurrentStep({
}
if (currentStepId === 'notifications') {
await updateSettings({
notifications: {
...settings.notifications,
enabled: true,
agentTaskComplete: true,
terminalBell: true
}
notifications: buildCompletedOnboardingNotificationSettings(settings.notifications)
})
useAppStore.getState().recordFeatureInteraction('notifications')
onOnboardingChange(await persistStep(ONBOARDING_FINAL_STEP))
+10 -1
View File
@@ -1,5 +1,9 @@
import { describe, expect, it } from 'vitest'
import { getDefaultPrimarySelectionMiddleClickPaste, getDefaultSettings } from './constants'
import {
getDefaultNotificationSettings,
getDefaultPrimarySelectionMiddleClickPaste,
getDefaultSettings
} from './constants'
describe('getDefaultSettings', () => {
it('uses platform-consistent separators for the default workspace directory', () => {
@@ -61,6 +65,11 @@ describe('getDefaultSettings', () => {
expect(getDefaultSettings('/tmp').compactWorktreeCards).toBe(false)
})
it('suppresses notifications for the focused worktree by default for new users', () => {
expect(getDefaultNotificationSettings().suppressWhenFocused).toBe(true)
expect(getDefaultSettings('/tmp').notifications.suppressWhenFocused).toBe(true)
})
it('defaults agent launch args to yolo mode where the CLI supports it', () => {
const settings = getDefaultSettings('/tmp')