mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #3214 from overleaf/jel-new-cta-email-verifyEmailToJoinTeam
Convert verifyEmailToJoinTeam to new email handling GitOrigin-RevId: f4d19aff26c07bb04d8f414805edbf79baec6e0c
This commit is contained in:
parent
6e60c99128
commit
d23df6dd99
2 changed files with 51 additions and 4 deletions
|
@ -330,7 +330,7 @@ templates.projectInvite = CTAEmailTemplate({
|
|||
}
|
||||
})
|
||||
|
||||
templates.verifyEmailToJoinTeam = CTAEmailTemplate({
|
||||
templates.verifyEmailToJoinTeam = ctaTemplate({
|
||||
subject(opts) {
|
||||
return `${_.escape(
|
||||
_formatUserNameAndEmail(opts.inviter, 'A collaborator')
|
||||
|
@ -342,9 +342,11 @@ templates.verifyEmailToJoinTeam = CTAEmailTemplate({
|
|||
)} has invited you to join a team on ${settings.appName}`
|
||||
},
|
||||
message(opts) {
|
||||
return `Please click the button below to join the team and enjoy the benefits of an upgraded ${
|
||||
settings.appName
|
||||
} account.`
|
||||
return [
|
||||
`Please click the button below to join the team and enjoy the benefits of an upgraded ${
|
||||
settings.appName
|
||||
} account.`
|
||||
]
|
||||
},
|
||||
ctaText(opts) {
|
||||
return 'Join now'
|
||||
|
|
|
@ -230,6 +230,51 @@ describe('EmailBuilder', function() {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('verifyEmailToJoinTeam', function() {
|
||||
before(function() {
|
||||
this.emailAddress = 'example@overleaf.com'
|
||||
this.opts = {
|
||||
to: this.emailAddress,
|
||||
acceptInviteUrl: `${
|
||||
this.settings.siteUrl
|
||||
}/subscription/invites/aToken123/`,
|
||||
inviter: {
|
||||
email: 'deanna@overleaf.com',
|
||||
first_name: 'Deanna',
|
||||
last_name: 'Troi'
|
||||
}
|
||||
}
|
||||
this.email = this.EmailBuilder.buildEmail(
|
||||
'verifyEmailToJoinTeam',
|
||||
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("Join now")')
|
||||
expect(buttonLink.length).to.equal(1)
|
||||
expect(buttonLink.attr('href')).to.equal(this.opts.acceptInviteUrl)
|
||||
const fallback = dom('.avoid-auto-linking').last()
|
||||
expect(fallback.length).to.equal(1)
|
||||
const fallbackLink = fallback.html()
|
||||
expect(fallbackLink).to.contain(this.opts.acceptInviteUrl)
|
||||
})
|
||||
})
|
||||
|
||||
describe('plain text email', function() {
|
||||
it('should contain the CTA link', function() {
|
||||
expect(this.email.text).to.contain(this.opts.acceptInviteUrl)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
describe('no CTA', function() {
|
||||
describe('securityAlert', function() {
|
||||
|
|
Loading…
Reference in a new issue