Improve update email

This commit is contained in:
Johannes
2016-11-07 12:46:03 +01:00
parent 45b83232d7
commit bd0b66aaad
2 changed files with 33 additions and 24 deletions
+6 -5
View File
@@ -1,8 +1,8 @@
<%if (format === 'text') { %>
Dear Admin,
Dear <%= cloudronName %> Admin,
Version <%= newBoxVersion %> of Cloudron <%= fqdn %> is now available!
Version <%= newBoxVersion %> for Cloudron <%= fqdn %> is now available!
Your Cloudron will update automatically tonight. Alternately, update immediately at <%= webadminUrl %>.
@@ -20,14 +20,15 @@ your Cloudron
<img src="<%= cloudronAvatarUrl %>" width="128px" height="128px"/>
<h3>Dear Admin,</h3>
<h3>Dear <%= cloudronName %> Admin,</h3>
<p>
Version <%= newBoxVersion %> of Cloudron <%= fqdn %> is now available!
Version <b><%= newBoxVersion %></b> for Cloudron <%= fqdn %> is now available!
</p>
<p>
Your Cloudron will update automatically tonight. Alternately, update immediately at <%= webadminUrl %>.
Your Cloudron will update automatically tonight.<br/>
Alternately, update immediately <a href="<%= webadminUrl %>">here</a>.
</p>
<h5>Changelog:</h5>
+27 -19
View File
@@ -393,29 +393,37 @@ function boxUpdateAvailable(newBoxVersion, changelog) {
getAdminEmails(function (error, adminEmails) {
if (error) return console.log('Error getting admins', error);
var templateData = {
fqdn: config.fqdn(),
webadminUrl: config.adminOrigin(),
newBoxVersion: newBoxVersion,
changelog: changelog,
cloudronAvatarUrl: config.adminOrigin() + '/api/v1/cloudron/avatar'
};
settings.getCloudronName(function (error, cloudronName) {
if (error) {
console.error(error);
cloudronName = 'Cloudron';
}
var templateDataText = JSON.parse(JSON.stringify(templateData));
templateDataText.format = 'text';
var templateData = {
fqdn: config.fqdn(),
webadminUrl: config.adminOrigin(),
newBoxVersion: newBoxVersion,
changelog: changelog,
cloudronName: cloudronName,
cloudronAvatarUrl: config.adminOrigin() + '/api/v1/cloudron/avatar'
};
var templateDataHTML = JSON.parse(JSON.stringify(templateData));
templateDataHTML.format = 'html';
var templateDataText = JSON.parse(JSON.stringify(templateData));
templateDataText.format = 'text';
var mailOptions = {
from: mailConfig().from,
to: adminEmails.join(', '),
subject: util.format('%s has a new update available', config.fqdn()),
text: render('box_update_available.ejs', templateDataText),
html: render('box_update_available.ejs', templateDataHTML)
};
var templateDataHTML = JSON.parse(JSON.stringify(templateData));
templateDataHTML.format = 'html';
enqueue(mailOptions);
var mailOptions = {
from: mailConfig().from,
to: adminEmails.join(', '),
subject: util.format('%s has a new update available', config.fqdn()),
text: render('box_update_available.ejs', templateDataText),
html: render('box_update_available.ejs', templateDataHTML)
};
enqueue(mailOptions);
});
});
}