diff --git a/src/notifications.js b/src/notifications.js index 7e241396b..4285fb6d0 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -14,6 +14,7 @@ exports = module.exports = { ALERT_DISK_SPACE: 'diskSpace', ALERT_MAIL_STATUS: 'mailStatus', ALERT_REBOOT: 'reboot', + ALERT_BOX_UPDATE: 'boxUpdate', alert: alert, @@ -40,7 +41,8 @@ const ALERT_TITLES = { backupConfig: 'Backup configuration is unsafe', diskSpace: 'Out of Disk Space', mailStatus: 'Email is not configured properly', - reboot: 'Reboot Required' + reboot: 'Reboot Required', + boxUpdate: 'New Cloudron Update Available' }; function NotificationsError(reason, errorOrMessage) { diff --git a/src/updatechecker.js b/src/updatechecker.js index b9c19b0c6..d77e5add3 100644 --- a/src/updatechecker.js +++ b/src/updatechecker.js @@ -18,6 +18,7 @@ var apps = require('./apps.js'), constants = require('./constants.js'), debug = require('debug')('box:updatechecker'), mailer = require('./mailer.js'), + notifications = require('./notifications.js'), paths = require('./paths.js'), safe = require('safetydance'), settings = require('./settings.js'); @@ -160,19 +161,9 @@ function checkBoxUpdates(callback) { callback(); } - // always send notifications if user is on the free plan - if (appstore.isFreePlan(result)) { - mailer.boxUpdateAvailable(false /* hasSubscription */, updateInfo.version, updateInfo.changelog); - return done(); - } + const message = `Cloudron version ${updateInfo.version} is available. Click [here](/#/settings) to update.\n\nChangelog: ${updateInfo.changelog}`; - // only send notifications if update pattern is 'never' - settings.getBoxAutoupdatePattern(function (error, result) { - if (error) debug(error); - else if (result === constants.AUTOUPDATE_PATTERN_NEVER) mailer.boxUpdateAvailable(true /* hasSubscription */, updateInfo.version, updateInfo.changelog); - - done(); - }); + notifications.alert(notifications.ALERT_BOX_UPDATE, message, done); }); }); }