Snooze immediately after account creation, prevent showing right after signup
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
|||||||
import {tryFetchGates} from '#/lib/statsig/statsig'
|
import {tryFetchGates} from '#/lib/statsig/statsig'
|
||||||
import {getAge} from '#/lib/strings/time'
|
import {getAge} from '#/lib/strings/time'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
|
import {snoozeEmailConfirmationPrompt} from '#/state/shell/reminders'
|
||||||
import {
|
import {
|
||||||
configureModerationForAccount,
|
configureModerationForAccount,
|
||||||
configureModerationForGuest,
|
configureModerationForGuest,
|
||||||
@@ -191,6 +192,13 @@ export async function createAgentAndCreateAccount(
|
|||||||
agent.setPersonalDetails({birthDate: birthDate.toISOString()})
|
agent.setPersonalDetails({birthDate: birthDate.toISOString()})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// snooze first prompt after signup, defer to next prompt
|
||||||
|
snoozeEmailConfirmationPrompt()
|
||||||
|
} catch (e: any) {
|
||||||
|
logger.error(e, {context: `session: failed snoozeEmailConfirmationPrompt`})
|
||||||
|
}
|
||||||
|
|
||||||
return prepareAgent(agent, gates, moderation, onSessionChange)
|
return prepareAgent(agent, gates, moderation, onSessionChange)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export function shouldRequestEmailConfirmation(account: SessionAccount) {
|
|||||||
|
|
||||||
// never been snoozed, new account
|
// never been snoozed, new account
|
||||||
if (!snoozedAt) {
|
if (!snoozedAt) {
|
||||||
snooze()
|
snoozeEmailConfirmationPrompt()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,16 +34,16 @@ export function shouldRequestEmailConfirmation(account: SessionAccount) {
|
|||||||
|
|
||||||
// snoozed recently
|
// snoozed recently
|
||||||
if (snoozedAt !== today) {
|
if (snoozedAt !== today) {
|
||||||
snooze()
|
snoozeEmailConfirmationPrompt()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// should never happen
|
// should never happen
|
||||||
snooze()
|
snoozeEmailConfirmationPrompt()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
export function snooze() {
|
export function snoozeEmailConfirmationPrompt() {
|
||||||
const lastEmailConfirm = new Date().toISOString()
|
const lastEmailConfirm = new Date().toISOString()
|
||||||
logger.debug('Snoozing email confirmation reminder', {
|
logger.debug('Snoozing email confirmation reminder', {
|
||||||
snoozedAt: lastEmailConfirm,
|
snoozedAt: lastEmailConfirm,
|
||||||
|
|||||||
Reference in New Issue
Block a user