fix(mailer): Fix the color of the ios and android store links.

fixes #150
This commit is contained in:
Shane Tomlinson 2016-05-20 16:05:23 +01:00
Родитель 062508e2ff
Коммит 864c262631
4 изменённых файлов: 50 добавлений и 6 удалений

Просмотреть файл

@ -388,6 +388,8 @@ module.exports = function (log) {
// details at github.com/mozilla/fxa-auth-mailer/issues/110
var postVerifyUtmParams = '?utm_source=email&utm_medium=email&utm_campaign=fx-account-verified'
var link = this.syncUrl + postVerifyUtmParams
var anrdoidLink = this.androidUrl + postVerifyUtmParams
var iosLink = this.iosUrl + postVerifyUtmParams
return this.send({
acceptLanguage: message.acceptLanguage,
@ -399,8 +401,10 @@ module.exports = function (log) {
template: 'postVerifyEmail',
templateValues: {
link: link,
androidUrl: this.androidUrl + postVerifyUtmParams,
iosUrl: this.iosUrl + postVerifyUtmParams,
androidUrl: anrdoidLink,
androidLinkAttributes: linkAttributes(anrdoidLink),
iosUrl: iosLink,
iosLinkAttributes: linkAttributes(iosLink),
supportUrl: this.supportUrl,
supportLinkAttributes: this._supportLinkAttributes()
},

Просмотреть файл

@ -5,7 +5,7 @@
<tr style="page-break-before: always">
<td valign="top">
<h1 style="font-family: sans-serif; font-weight: normal; margin: 0 0 24px 0; text-align: center;">{{t "Account verified!" }}</h1>
<p class="primary" style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 24px 0; text-align: center;">{{{t "You successfully connected your first device to your Firefox Account. Now you can sign in to Sync from your other devices, including Firefox for <a href='%(androidUrl)s'>Android</a> and <a href='%(iosUrl)s'>iOS</a>." }}}</p>
<p class="primary" style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 24px 0; text-align: center;">{{{t "You successfully connected your first device to your Firefox Account. Now you can sign in to Sync from your other devices, including Firefox for <a %(androidLinkAttributes)s>Android</a> and <a %(iosLinkAttributes)s>iOS</a>." }}}</p>
</td>
</tr>

Просмотреть файл

@ -20,7 +20,7 @@
<tr style="page-break-before: always">
<td valign="top">
<h1 style="font-family: sans-serif; font-weight: normal; margin: 0 0 24px 0; text-align: center;">{{t "Account verified!" }}</h1>
<p class="primary" style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 24px 0; text-align: center;">{{{t "You successfully connected your first device to your Firefox Account. Now you can sign in to Sync from your other devices, including Firefox for <a href='%(androidUrl)s'>Android</a> and <a href='%(iosUrl)s'>iOS</a>." }}}</p>
<p class="primary" style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0 0 24px 0; text-align: center;">{{{t "You successfully connected your first device to your Firefox Account. Now you can sign in to Sync from your other devices, including Firefox for <a %(androidLinkAttributes)s>Android</a> and <a %(iosLinkAttributes)s>iOS</a>." }}}</p>
</td>
</tr>

Просмотреть файл

@ -27,7 +27,7 @@ var messageTypes = [
'verifyLoginEmail'
]
var typesWithSupportLinks = [
var typesContainSupportLinks = [
'newDeviceLoginEmail',
'passwordChangedEmail',
'passwordResetEmail',
@ -54,6 +54,14 @@ var typesContainSignInLinks = [
'recoveryEmail'
]
var typesContainAndroidStoreLinks = [
'postVerifyEmail'
]
var typesContainIOSStoreLinks = [
'postVerifyEmail'
]
function includes(haystack, needle) {
return (haystack.indexOf(needle) > -1)
}
@ -82,7 +90,7 @@ P.all(
var supportHtmlLink = new RegExp('<a href="' + config.get('mail').supportUrl + '" style="color: #0095dd; text-decoration: none; font-family: sans-serif;">Mozilla Support</a>')
var supportTextLink = config.get('mail').supportUrl
if (includes(typesWithSupportLinks, type)) {
if (includes(typesContainSupportLinks, type)) {
test(
'test support link is in email template output for ' + type,
function (t) {
@ -127,6 +135,38 @@ P.all(
)
}
if (includes(typesContainAndroidStoreLinks, type)) {
var androidStoreLink = mailer.androidUrl
test(
'Android store link is in email template output for ' + type,
function (t) {
mailer.mailer.sendMail = function (emailConfig) {
t.ok(includes(emailConfig.html, androidStoreLink))
// only the html email contains links to the store
t.end()
}
mailer[type](message)
}
)
}
if (includes(typesContainIOSStoreLinks, type)) {
var iosStoreLink = mailer.iosUrl
test(
'IOS store link is in email template output for ' + type,
function (t) {
mailer.mailer.sendMail = function (emailConfig) {
t.ok(includes(emailConfig.html, iosStoreLink))
// only the html email contains links to the store
t.end()
}
mailer[type](message)
}
)
}
if (includes(typesContainSignInLinks, type)) {
var signInLink = mailer.createSignInLink(message.email)
test(