mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
[web] Remove deprecated welcome email (#34320)
It was replaced by `welcomeWithoutCTA` a long time ago GitOrigin-RevId: 688edafcdaf6acb20cb12346335db480d4973159
This commit is contained in:
@@ -917,52 +917,6 @@ templates.SAMLDataCleared = ctaTemplate({
|
||||
},
|
||||
})
|
||||
|
||||
templates.welcome = ctaTemplate({
|
||||
subject() {
|
||||
return `Welcome to ${settings.appName}`
|
||||
},
|
||||
title() {
|
||||
return `Welcome to ${settings.appName}`
|
||||
},
|
||||
greeting() {
|
||||
return 'Hi,'
|
||||
},
|
||||
message(opts, isPlainText) {
|
||||
const logInAgainDisplay = EmailMessageHelper.displayLink(
|
||||
'log in again',
|
||||
`${settings.siteUrl}/login`,
|
||||
isPlainText
|
||||
)
|
||||
const helpGuidesDisplay = EmailMessageHelper.displayLink(
|
||||
'Help Guides',
|
||||
`${settings.siteUrl}/learn`,
|
||||
isPlainText
|
||||
)
|
||||
const templatesDisplay = EmailMessageHelper.displayLink(
|
||||
'Templates',
|
||||
`${settings.siteUrl}/templates`,
|
||||
isPlainText
|
||||
)
|
||||
|
||||
return [
|
||||
`Thanks for signing up to ${settings.appName}! If you ever get lost, you can ${logInAgainDisplay} with the email address '${opts.to}'.`,
|
||||
`If you're new to LaTeX, take a look at our ${helpGuidesDisplay} and ${templatesDisplay}.`,
|
||||
`Please also take a moment to confirm your email address for ${settings.appName}:`,
|
||||
]
|
||||
},
|
||||
secondaryMessage() {
|
||||
return [
|
||||
`PS. We love talking to our users about ${settings.appName}. Reply to this email to get in touch with us directly, whatever the reason. Questions, comments, problems, suggestions, all welcome!`,
|
||||
]
|
||||
},
|
||||
ctaText() {
|
||||
return 'Confirm email'
|
||||
},
|
||||
ctaURL(opts) {
|
||||
return opts.confirmEmailUrl
|
||||
},
|
||||
})
|
||||
|
||||
templates.welcomeWithoutCTA = NoCTAEmailTemplate({
|
||||
subject() {
|
||||
return `Welcome to ${settings.appName}`
|
||||
|
||||
@@ -621,55 +621,6 @@ describe('EmailBuilder', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('welcome', function () {
|
||||
beforeEach(function (ctx) {
|
||||
ctx.emailAddress = 'example@overleaf.com'
|
||||
ctx.opts = {
|
||||
to: ctx.emailAddress,
|
||||
confirmEmailUrl: `${ctx.settings.siteUrl}/user/emails/confirm?token=token123`,
|
||||
}
|
||||
ctx.email = ctx.EmailBuilder.buildEmail('welcome', ctx.opts)
|
||||
ctx.dom = cheerio.load(ctx.email.html)
|
||||
})
|
||||
|
||||
it('should build the email', function (ctx) {
|
||||
expect(ctx.email.html).to.exist
|
||||
expect(ctx.email.text).to.exist
|
||||
})
|
||||
|
||||
describe('HTML email', function () {
|
||||
it('should include a CTA button and a fallback CTA link', function (ctx) {
|
||||
const buttonLink = ctx.dom('a:contains("Confirm email")')
|
||||
expect(buttonLink.length).to.equal(1)
|
||||
expect(buttonLink.attr('href')).to.equal(ctx.opts.confirmEmailUrl)
|
||||
expect(ctx.email.html).to.contain('copy and paste this link')
|
||||
expect(ctx.email.html).to.contain(ctx.opts.confirmEmailUrl)
|
||||
})
|
||||
it('should include help links', function (ctx) {
|
||||
const helpGuidesLink = ctx.dom('a:contains("Help Guides")')
|
||||
const templatesLink = ctx.dom('a:contains("Templates")')
|
||||
const logInLink = ctx.dom('a:contains("log in")')
|
||||
expect(helpGuidesLink.length).to.equal(1)
|
||||
expect(templatesLink.length).to.equal(1)
|
||||
expect(logInLink.length).to.equal(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe('plain text email', function () {
|
||||
it('should contain the CTA URL', function (ctx) {
|
||||
expect(ctx.email.text).to.contain(ctx.opts.confirmEmailUrl)
|
||||
})
|
||||
it('should include help URL', function (ctx) {
|
||||
expect(ctx.email.text).to.contain('/learn')
|
||||
expect(ctx.email.text).to.contain('/login')
|
||||
expect(ctx.email.text).to.contain('/templates')
|
||||
})
|
||||
it('should contain HTML links', function (ctx) {
|
||||
expect(ctx.email.text).to.not.contain('<a')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('groupSSODisabled', function () {
|
||||
it('should build the email for non managed and linked users', function (ctx) {
|
||||
const setNewPasswordUrl = `${ctx.settings.siteUrl}/user/password/reset`
|
||||
|
||||
@@ -66,7 +66,7 @@ describe('EmailHandler', function () {
|
||||
describe('send email', function () {
|
||||
it('should use the correct options', async function (ctx) {
|
||||
const opts = { to: 'bob@bob.com' }
|
||||
await ctx.EmailHandler.promises.sendEmail('welcome', opts)
|
||||
await ctx.EmailHandler.promises.sendEmail('welcomeWithoutCTA', opts)
|
||||
expect(ctx.EmailSender.promises.sendEmail).to.have.been.calledWithMatch({
|
||||
html: ctx.html,
|
||||
})
|
||||
@@ -78,14 +78,15 @@ describe('EmailHandler', function () {
|
||||
to: 'bob@bob.com',
|
||||
subject: 'hello bob',
|
||||
}
|
||||
await expect(ctx.EmailHandler.promises.sendEmail('welcome', opts)).to.be
|
||||
.rejected
|
||||
await expect(
|
||||
ctx.EmailHandler.promises.sendEmail('welcomeWithoutCTA', opts)
|
||||
).to.be.rejected
|
||||
})
|
||||
|
||||
it('should not send an email if lifecycle is not enabled', async function (ctx) {
|
||||
ctx.Settings.email.lifecycle = false
|
||||
ctx.EmailBuilder.buildEmail.returns({ type: 'lifecycle' })
|
||||
await ctx.EmailHandler.promises.sendEmail('welcome', {})
|
||||
await ctx.EmailHandler.promises.sendEmail('welcomeWithoutCTA', {})
|
||||
expect(ctx.EmailSender.promises.sendEmail).not.to.have.been.called
|
||||
})
|
||||
|
||||
@@ -93,7 +94,7 @@ describe('EmailHandler', function () {
|
||||
ctx.Settings.email.lifecycle = false
|
||||
ctx.EmailBuilder.buildEmail.returns({ type: 'notification' })
|
||||
const opts = { to: 'bob@bob.com' }
|
||||
await ctx.EmailHandler.promises.sendEmail('welcome', opts)
|
||||
await ctx.EmailHandler.promises.sendEmail('welcomeWithoutCTA', opts)
|
||||
expect(ctx.EmailSender.promises.sendEmail).to.have.been.called
|
||||
})
|
||||
|
||||
@@ -101,7 +102,7 @@ describe('EmailHandler', function () {
|
||||
ctx.Settings.email.lifecycle = true
|
||||
ctx.EmailBuilder.buildEmail.returns({ type: 'lifecycle' })
|
||||
const opts = { to: 'bob@bob.com' }
|
||||
await ctx.EmailHandler.promises.sendEmail('welcome', opts)
|
||||
await ctx.EmailHandler.promises.sendEmail('welcomeWithoutCTA', opts)
|
||||
expect(ctx.EmailSender.promises.sendEmail).to.have.been.called
|
||||
})
|
||||
|
||||
@@ -116,7 +117,7 @@ describe('EmailHandler', function () {
|
||||
text: ctx.text,
|
||||
})
|
||||
const opts = { to: 'bob@bob.com' }
|
||||
await ctx.EmailHandler.promises.sendEmail('welcome', opts)
|
||||
await ctx.EmailHandler.promises.sendEmail('welcomeWithoutCTA', opts)
|
||||
expect(ctx.EmailSender.promises.sendEmail).to.have.been.calledWithMatch(
|
||||
{
|
||||
html: ctx.html,
|
||||
|
||||
Reference in New Issue
Block a user