Revert "Don't send creator guide email & interesting markets on create user"
This reverts commit a4399aaee9
.
This commit is contained in:
parent
6d7fbd69c7
commit
ac952f1164
|
@ -4,8 +4,14 @@ import * as utc from 'dayjs/plugin/utc'
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
|
|
||||||
import { getPrivateUser } from './utils'
|
import { getPrivateUser } from './utils'
|
||||||
import { User } from '../../common/user'
|
import { User } from 'common/user'
|
||||||
import { sendPersonalFollowupEmail, sendWelcomeEmail } from './emails'
|
import {
|
||||||
|
sendCreatorGuideEmail,
|
||||||
|
sendInterestingMarketsEmail,
|
||||||
|
sendPersonalFollowupEmail,
|
||||||
|
sendWelcomeEmail,
|
||||||
|
} from './emails'
|
||||||
|
import { getTrendingContracts } from './weekly-markets-emails'
|
||||||
|
|
||||||
export const onCreateUser = functions
|
export const onCreateUser = functions
|
||||||
.runWith({ secrets: ['MAILGUN_KEY'] })
|
.runWith({ secrets: ['MAILGUN_KEY'] })
|
||||||
|
@ -17,6 +23,23 @@ export const onCreateUser = functions
|
||||||
|
|
||||||
await sendWelcomeEmail(user, privateUser)
|
await sendWelcomeEmail(user, privateUser)
|
||||||
|
|
||||||
|
const guideSendTime = dayjs().add(28, 'hours').toString()
|
||||||
|
await sendCreatorGuideEmail(user, privateUser, guideSendTime)
|
||||||
|
|
||||||
const followupSendTime = dayjs().add(48, 'hours').toString()
|
const followupSendTime = dayjs().add(48, 'hours').toString()
|
||||||
await sendPersonalFollowupEmail(user, privateUser, followupSendTime)
|
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 contracts = await getTrendingContracts()
|
||||||
|
const marketsSendTime = dayjs().add(24, 'hours').toString()
|
||||||
|
|
||||||
|
await sendInterestingMarketsEmail(
|
||||||
|
user,
|
||||||
|
privateUser,
|
||||||
|
contracts,
|
||||||
|
marketsSendTime
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user