mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-22 15:18:11 +00:00
Merge pull request #3212 from overleaf/jel-new-cta-email-confirmEmail
Convert confirmEmail to new email handling GitOrigin-RevId: 66d1bd7503d36cc74adfadc983003c31c2c57bd1
This commit is contained in:
parent
d23df6dd99
commit
e1bcf93374
2 changed files with 41 additions and 2 deletions
services/web
|
@ -273,7 +273,7 @@ templates.passwordResetRequested = ctaTemplate({
|
|||
}
|
||||
})
|
||||
|
||||
templates.confirmEmail = CTAEmailTemplate({
|
||||
templates.confirmEmail = ctaTemplate({
|
||||
subject() {
|
||||
return `Confirm Email - ${settings.appName}`
|
||||
},
|
||||
|
@ -281,7 +281,7 @@ templates.confirmEmail = CTAEmailTemplate({
|
|||
return 'Confirm Email'
|
||||
},
|
||||
message() {
|
||||
return `Please confirm your email on ${settings.appName}.`
|
||||
return [`Please confirm your email on ${settings.appName}.`]
|
||||
},
|
||||
ctaText() {
|
||||
return 'Confirm Email'
|
||||
|
|
|
@ -142,6 +142,45 @@ describe('EmailBuilder', function() {
|
|||
|
||||
describe('templates', function() {
|
||||
describe('CTA', function() {
|
||||
describe('confirmEmail', function() {
|
||||
before(function() {
|
||||
this.emailAddress = 'example@overleaf.com'
|
||||
this.userId = 'abc123'
|
||||
this.opts = {
|
||||
to: this.emailAddress,
|
||||
confirmEmailUrl: `${
|
||||
this.settings.siteUrl
|
||||
}/user/emails/confirm?token=aToken123`,
|
||||
sendingUser_id: this.userId
|
||||
}
|
||||
this.email = this.EmailBuilder.buildEmail('confirmEmail', this.opts)
|
||||
})
|
||||
|
||||
it('should build the email', function() {
|
||||
expect(this.email.html).to.exist
|
||||
expect(this.email.text).to.exist
|
||||
})
|
||||
|
||||
describe('HTML email', function() {
|
||||
it('should include a CTA button and a fallback CTA link', function() {
|
||||
const dom = cheerio.load(this.email.html)
|
||||
const buttonLink = dom('a:contains("Confirm Email")')
|
||||
expect(buttonLink.length).to.equal(1)
|
||||
expect(buttonLink.attr('href')).to.equal(this.opts.confirmEmailUrl)
|
||||
const fallback = dom('.avoid-auto-linking').last()
|
||||
expect(fallback.length).to.equal(1)
|
||||
const fallbackLink = fallback.html()
|
||||
expect(fallbackLink).to.contain(this.opts.confirmEmailUrl)
|
||||
})
|
||||
})
|
||||
|
||||
describe('plain text email', function() {
|
||||
it('should contain the CTA link', function() {
|
||||
expect(this.email.text).to.contain(this.opts.confirmEmailUrl)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('ownershipTransferConfirmationNewOwner', function() {
|
||||
before(function() {
|
||||
this.emailAddress = 'example@overleaf.com'
|
||||
|
|
Loading…
Add table
Reference in a new issue