From 8920241c39af6f1d65513288619b5e58e28b451c Mon Sep 17 00:00:00 2001 From: mantikoros Date: Tue, 20 Sep 2022 15:56:28 -0500 Subject: [PATCH] space out onboarding emails --- functions/src/on-create-user.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/functions/src/on-create-user.ts b/functions/src/on-create-user.ts index 844f75fc..03c6dda0 100644 --- a/functions/src/on-create-user.ts +++ b/functions/src/on-create-user.ts @@ -23,15 +23,21 @@ export const onCreateUser = functions await sendWelcomeEmail(user, privateUser) - const guideSendTime = dayjs().add(28, 'hours').toString() - await sendCreatorGuideEmail(user, privateUser, guideSendTime) - const followupSendTime = dayjs().add(48, 'hours').toString() await sendPersonalFollowupEmail(user, privateUser, followupSendTime) - // skip email if weekly email is about to go out const day = dayjs().utc().day() - if (day === 0 || (day === 1 && dayjs().utc().hour() <= 19)) return + + const skipInterestingMarkets = + // skip email if weekly email is about to go out + day === 0 || (day === 1 && dayjs().utc().hour() <= 19) + + const guideSendTime = dayjs() + .add(skipInterestingMarkets ? 24 : 96, 'hours') + .toString() + await sendCreatorGuideEmail(user, privateUser, guideSendTime) + + if (skipInterestingMarkets) return const contracts = await getTrendingContracts() const marketsSendTime = dayjs().add(24, 'hours').toString()