diff --git a/functions/src/email-templates/market-resolved.html b/functions/src/email-templates/market-resolved.html index e8b090b5..c1ff3beb 100644 --- a/functions/src/email-templates/market-resolved.html +++ b/functions/src/email-templates/market-resolved.html @@ -1,84 +1,91 @@ - - - - - Market resolved + "> - - - - +
- + - - + + +
+ -
+
- +
- + - - -
+ - +
- + - - - + + Manifold Markets + + + + - - - + {{creatorName}} asked + + + - - - + {{question}} + + + - - - + Resolved {{outcome}} + + + + - - -
+ - Manifold Markets -
+ - {{creatorName}} asked -
+ - + - {{question}} -
+ -

+

- Resolved {{outcome}} -

-
+ - +
- + - - - + + + - - -
+ - Dear {{name}}, -
+ Dear {{name}}, +
-
+
- A market you bet in has been resolved! -
+ A market you bet in has been resolved! +
-
+
- Your investment was - M$ {{investment}}. -
+ Your investment was + {{investment}}. +
-
+
- Your payout is - M$ {{payout}}. -
+ Your payout is + {{payout}}. +
-
+
- Thanks, -
+ Thanks, +
- Manifold Team -
+ Manifold Team +
-
+
-
-
- - +
+ -
-
-
- +
+ + + + + + + + ">unsubscribe. + + + - - - - - - + " valign="top"> + + + + + \ No newline at end of file diff --git a/functions/src/emails.ts b/functions/src/emails.ts index e6e52090..ff313794 100644 --- a/functions/src/emails.ts +++ b/functions/src/emails.ts @@ -53,22 +53,29 @@ export const sendMarketResolutionEmail = async ( const subject = `Resolved ${outcome}: ${contract.question}` - // const creatorPayoutText = - // userId === creator.id - // ? ` (plus ${formatMoney(creatorPayout)} in commissions)` - // : '' + const creatorPayoutText = + creatorPayout >= 1 && userId === creator.id + ? ` (plus ${formatMoney(creatorPayout)} in commissions)` + : '' const emailType = 'market-resolved' const unsubscribeUrl = `${UNSUBSCRIBE_ENDPOINT}?id=${userId}&type=${emailType}` + const displayedInvestment = + Number.isNaN(investment) || investment < 0 + ? formatMoney(0) + : formatMoney(investment) + + const displayedPayout = formatMoney(payout) + const templateData: market_resolved_template = { userId: user.id, name: user.name, creatorName: creator.name, question: contract.question, outcome, - investment: `${Math.floor(investment)}`, - payout: `${Math.floor(payout)}`, + investment: displayedInvestment, + payout: displayedPayout + creatorPayoutText, url: `https://${DOMAIN}/${creator.username}/${contract.slug}`, unsubscribeUrl, }