sendMarketCloseEmail: handle unsubscribe

This commit is contained in:
mantikoros 2022-02-16 22:22:46 -06:00
parent bf117aef46
commit cbd8a7a790

View File

@ -95,6 +95,13 @@ export const sendMarketCloseEmail = async (
privateUser: PrivateUser, privateUser: PrivateUser,
contract: Contract contract: Contract
) => { ) => {
if (
!privateUser ||
privateUser.unsubscribedFromResolutionEmails ||
!privateUser.email
)
return
const { username, name, id: userId } = user const { username, name, id: userId } = user
const firstName = name.split(' ')[0] const firstName = name.split(' ')[0]
@ -103,7 +110,7 @@ export const sendMarketCloseEmail = async (
const url = `https://manifold.markets/${username}/${slug}` const url = `https://manifold.markets/${username}/${slug}`
await sendTemplateEmail( await sendTemplateEmail(
privateUser.email || '', privateUser.email,
'Your market has closed', 'Your market has closed',
'market-close', 'market-close',
{ {