mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-10 19:51:45 +00:00
Merge pull request #1928 from overleaf/jel-email-after-registration
Send welcome email after registration GitOrigin-RevId: 1f2b34299e6f4a1e4e44c100711e8f3b8db54595
This commit is contained in:
parent
f8d895100a
commit
02a4289422
2 changed files with 99 additions and 0 deletions
56
services/web/app/src/Features/Email/Bodies/NoCTAEmailBody.js
Normal file
56
services/web/app/src/Features/Email/Bodies/NoCTAEmailBody.js
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
const _ = require('underscore')
|
||||||
|
|
||||||
|
module.exports = _.template(`\
|
||||||
|
<table class="row" style="border-collapse: collapse; border-spacing: 0; display: table; padding: 0; position: relative; text-align: left; vertical-align: top; width: 100%;">
|
||||||
|
<tbody>
|
||||||
|
<tr style="padding: 0; vertical-align: top;">
|
||||||
|
<th class="small-12 columns" style="margin: 0 auto; line-height: 1.3; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; text-align: left; width: 564px;">
|
||||||
|
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%; color: #5D6879; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: normal; line-height: 1.3;"><tr style="padding: 0; text-align: left; vertical-align: top;">
|
||||||
|
<th style="margin: 0; margin: 0; padding: 0; text-align: left;">
|
||||||
|
<% if (title) { %>
|
||||||
|
<h3 class="avoid-auto-linking" style="margin: 0; color: #5D6879; font-family: Georgia, serif; font-size: 24px; font-weight: normal; line-height: 1.3; margin: 0; padding: 0; text-align: left; word-wrap: normal;">
|
||||||
|
<%= title %>
|
||||||
|
</h3>
|
||||||
|
<% } %>
|
||||||
|
</th>
|
||||||
|
<tr><td>
|
||||||
|
<p style="height: 20px; margin: 0; padding: 0;"> </p>
|
||||||
|
|
||||||
|
<% if (greeting) { %>
|
||||||
|
<p style="margin: 0 10px 0 0; padding: 0;">
|
||||||
|
<%= greeting %>
|
||||||
|
</p>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<p class="avoid-auto-linking" style="margin: 0 10px 0 0; padding: 0;">
|
||||||
|
<%= message %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<% if (secondaryMessage) { %>
|
||||||
|
<p class="avoid-auto-linking" style="margin: 0 10px 0 0; padding: 0;">
|
||||||
|
<%= secondaryMessage %>
|
||||||
|
</p>
|
||||||
|
<% } %>
|
||||||
|
</td></tr>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</th>
|
||||||
|
</tr></tbody></table>
|
||||||
|
<% if (gmailGoToAction) { %>
|
||||||
|
<script type="application/ld+json">
|
||||||
|
<%=
|
||||||
|
StringHelper.stringifyJsonForScript({
|
||||||
|
"@context": "http://schema.org",
|
||||||
|
"@type": "EmailMessage",
|
||||||
|
"potentialAction": {
|
||||||
|
"@type": "ViewAction",
|
||||||
|
"target": gmailGoToAction.target,
|
||||||
|
"url": gmailGoToAction.target,
|
||||||
|
"name": gmailGoToAction.name
|
||||||
|
},
|
||||||
|
"description": gmailGoToAction.description
|
||||||
|
})
|
||||||
|
%>
|
||||||
|
</script>
|
||||||
|
<% } %>\
|
||||||
|
`)
|
|
@ -74,6 +74,48 @@ The ${settings.appName} Team - ${settings.siteUrl}\
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No CTA Email
|
||||||
|
const NoCTAEmailBody = require(`./Bodies/NoCTAEmailBody`)
|
||||||
|
const NoCTAEmailTemplate = function(content) {
|
||||||
|
if (content.greeting == null) {
|
||||||
|
content.greeting = () => 'Hi,'
|
||||||
|
}
|
||||||
|
if (content.secondaryMessage == null) {
|
||||||
|
content.secondaryMessage = () => ''
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
subject(opts) {
|
||||||
|
return content.subject(opts)
|
||||||
|
},
|
||||||
|
layout: BaseWithHeaderEmailLayout,
|
||||||
|
plainTextTemplate(opts) {
|
||||||
|
return `\
|
||||||
|
${content.greeting(opts)}
|
||||||
|
${content.message(opts).trim()}
|
||||||
|
${(typeof content.secondaryMessage === 'function'
|
||||||
|
? content.secondaryMessage(opts).trim()
|
||||||
|
: undefined) || ''}
|
||||||
|
Regards,
|
||||||
|
The ${settings.appName} Team - ${settings.siteUrl}\
|
||||||
|
`
|
||||||
|
},
|
||||||
|
compiledTemplate(opts) {
|
||||||
|
return NoCTAEmailBody({
|
||||||
|
title:
|
||||||
|
typeof content.title === 'function' ? content.title(opts) : undefined,
|
||||||
|
greeting: content.greeting(opts),
|
||||||
|
message: marked(content.message(opts).trim()),
|
||||||
|
secondaryMessage: marked(content.secondaryMessage(opts).trim()),
|
||||||
|
gmailGoToAction:
|
||||||
|
typeof content.gmailGoToAction === 'function'
|
||||||
|
? content.gmailGoToAction(opts)
|
||||||
|
: undefined,
|
||||||
|
StringHelper
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const templates = {}
|
const templates = {}
|
||||||
|
|
||||||
templates.accountMergeToOverleafAddress = CTAEmailTemplate({
|
templates.accountMergeToOverleafAddress = CTAEmailTemplate({
|
||||||
|
@ -423,6 +465,7 @@ If you have any questions, you can contact our support team by reply.\
|
||||||
module.exports = {
|
module.exports = {
|
||||||
templates,
|
templates,
|
||||||
CTAEmailTemplate,
|
CTAEmailTemplate,
|
||||||
|
NoCTAEmailTemplate,
|
||||||
buildEmail(templateName, opts) {
|
buildEmail(templateName, opts) {
|
||||||
const template = templates[templateName]
|
const template = templates[templateName]
|
||||||
opts.siteUrl = settings.siteUrl
|
opts.siteUrl = settings.siteUrl
|
||||||
|
|
Loading…
Reference in a new issue