diff --git a/src/mail_templates/box_update_available.ejs b/src/mail_templates/box_update_available.ejs
deleted file mode 100644
index 0ec8e878b..000000000
--- a/src/mail_templates/box_update_available.ejs
+++ /dev/null
@@ -1,56 +0,0 @@
-<%if (format === 'text') { %>
-
-Dear <%= cloudronName %> Admin,
-
-Version <%= newBoxVersion %> is now available!
-
-Changelog:
-<% for (var i = 0; i < changelog.length; i++) { %>
- * <%- changelog[i] %>
-<% } %>
-
-<% if (!hasSubscription) { -%>
-*Keep your Cloudron automatically up-to-date and secure by upgrading to a paid plan at* <%= webadminUrl %>/#/settings
-<% } -%>
-
-Powered by https://cloudron.io
-
-Sent at: <%= new Date().toUTCString() %>
-
-<% } else { %>
-
-
-
-
-
-Dear <%= cloudronName %> Admin,
-
-
-
- Version <%= newBoxVersion %> is now available!
-
-
-
Changelog:
-
- <% for (var i = 0; i < changelogHTML.length; i++) { %>
- - <%- changelogHTML[i] %>
- <% } %>
-
-
-
-
- <% if (!hasSubscription) { %>
-
Keep your Cloudron automatically up-to-date and secure by upgrading to a paid plan.
- <% } %>
-
-
-
-
-
-
-
-
-<% } %>
-
diff --git a/src/mailer.js b/src/mailer.js
index e4ffd60b3..49ce32f6a 100644
--- a/src/mailer.js
+++ b/src/mailer.js
@@ -5,7 +5,6 @@ exports = module.exports = {
userRemoved: userRemoved,
adminChanged: adminChanged,
passwordReset: passwordReset,
- boxUpdateAvailable: boxUpdateAvailable,
appUpdateAvailable: appUpdateAvailable,
sendDigest: sendDigest,
@@ -341,44 +340,6 @@ function appDied(mailTo, app) {
});
}
-function boxUpdateAvailable(hasSubscription, newBoxVersion, changelog) {
- assert.strictEqual(typeof hasSubscription, 'boolean');
- assert.strictEqual(typeof newBoxVersion, 'string');
- assert(util.isArray(changelog));
-
- getMailConfig(function (error, mailConfig) {
- if (error) return debug('Error getting mail details:', error);
-
- var converter = new showdown.Converter();
-
- var templateData = {
- webadminUrl: config.adminOrigin(),
- newBoxVersion: newBoxVersion,
- hasSubscription: hasSubscription,
- changelog: changelog,
- changelogHTML: changelog.map(function (e) { return converter.makeHtml(e); }),
- cloudronName: mailConfig.cloudronName,
- cloudronAvatarUrl: config.adminOrigin() + '/api/v1/cloudron/avatar'
- };
-
- var templateDataText = JSON.parse(JSON.stringify(templateData));
- templateDataText.format = 'text';
-
- var templateDataHTML = JSON.parse(JSON.stringify(templateData));
- templateDataHTML.format = 'html';
-
- var mailOptions = {
- from: mailConfig.notificationFrom,
- to: mailConfig.adminEmails.join(', '),
- subject: util.format('%s has a new update available', mailConfig.cloudronName),
- text: render('box_update_available.ejs', templateDataText),
- html: render('box_update_available.ejs', templateDataHTML)
- };
-
- enqueue(mailOptions);
- });
-}
-
function appUpdateAvailable(app, hasSubscription, info) {
assert.strictEqual(typeof app, 'object');
assert.strictEqual(typeof hasSubscription, 'boolean');
diff --git a/src/notifications.js b/src/notifications.js
index 4285fb6d0..bf195a6d6 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -42,7 +42,7 @@ const ALERT_TITLES = {
diskSpace: 'Out of Disk Space',
mailStatus: 'Email is not configured properly',
reboot: 'Reboot Required',
- boxUpdate: 'New Cloudron Update Available'
+ boxUpdate: 'New Cloudron Version Available'
};
function NotificationsError(reason, errorOrMessage) {
diff --git a/src/updatechecker.js b/src/updatechecker.js
index d77e5add3..ace0e51b2 100644
--- a/src/updatechecker.js
+++ b/src/updatechecker.js
@@ -152,18 +152,17 @@ function checkBoxUpdates(callback) {
return callback();
}
- appstore.getSubscription(function (error, result) {
+ const changelog = updateInfo.changelog.map((m) => `* ${m}\n`).join('');
+
+ const message = `Cloudron version ${updateInfo.version} is available. Click [here](/#/settings) to update.\n\nChangelog:\n${changelog}\n\n`;
+
+ notifications.alert(notifications.ALERT_BOX_UPDATE, message, function (error) {
if (error) return callback(error);
- function done() {
- state.box = updateInfo.version;
- saveState(state);
- callback();
- }
+ state.box = updateInfo.version;
+ saveState(state);
- const message = `Cloudron version ${updateInfo.version} is available. Click [here](/#/settings) to update.\n\nChangelog: ${updateInfo.changelog}`;
-
- notifications.alert(notifications.ALERT_BOX_UPDATE, message, done);
+ callback();
});
});
}