refactor: reduce global survey cooldown from 14 to 4 days

This commit is contained in:
bymyself
2026-01-23 20:50:50 -08:00
parent 3bd892a4d2
commit b650bbf543
2 changed files with 7 additions and 7 deletions

View File

@@ -134,12 +134,12 @@ describe('useSurveyEligibility', () => {
it('is not eligible during global cooldown', async () => {
setFeatureUsage('test-feature', 5)
const thirteenDaysAgo = Date.now() - 13 * 24 * 60 * 60 * 1000
const threeDaysAgo = Date.now() - 3 * 24 * 60 * 60 * 1000
localStorage.setItem(
SURVEY_STATE_KEY,
JSON.stringify({
seenSurveys: { 'other-feature': thirteenDaysAgo },
lastSurveyShown: thirteenDaysAgo,
seenSurveys: { 'other-feature': threeDaysAgo },
lastSurveyShown: threeDaysAgo,
optedOut: false
})
)
@@ -154,12 +154,12 @@ describe('useSurveyEligibility', () => {
it('is eligible after global cooldown expires', async () => {
setFeatureUsage('test-feature', 5)
const fifteenDaysAgo = Date.now() - 15 * 24 * 60 * 60 * 1000
const fiveDaysAgo = Date.now() - 5 * 24 * 60 * 60 * 1000
localStorage.setItem(
SURVEY_STATE_KEY,
JSON.stringify({
seenSurveys: { 'other-feature': fifteenDaysAgo },
lastSurveyShown: fifteenDaysAgo,
seenSurveys: { 'other-feature': fiveDaysAgo },
lastSurveyShown: fiveDaysAgo,
optedOut: false
})
)

View File

@@ -23,7 +23,7 @@ interface SurveyState {
}
const STORAGE_KEY = 'Comfy.SurveyState'
const GLOBAL_COOLDOWN_MS = 14 * 24 * 60 * 60 * 1000 // 14 days
const GLOBAL_COOLDOWN_MS = 4 * 24 * 60 * 60 * 1000 // 4 days
const DEFAULT_THRESHOLD = 3
const DEFAULT_DELAY_MS = 5000