diff --git a/src/cloudron.js b/src/cloudron.js index b9c0b65b4..920294dc9 100644 --- a/src/cloudron.js +++ b/src/cloudron.js @@ -208,7 +208,7 @@ function checkBackupConfiguration(callback) { backups.checkConfiguration(function (error, message) { if (error) return callback(error); - notifications.alert(notifications.ALERT_BACKUP_CONFIG, message, callback); + notifications.alert(notifications.ALERT_BACKUP_CONFIG, 'Backup configuration is unsafe', message, callback); }); } @@ -243,7 +243,7 @@ function checkDiskSpace(callback) { debug('Disk space checked. ok: %s', !oos); - notifications.alert(notifications.ALERT_DISK_SPACE, oos ? JSON.stringify(entries, null, 4) : '', callback); + notifications.alert(notifications.ALERT_DISK_SPACE, 'Server is running out of disk space', oos ? JSON.stringify(entries, null, 4) : '', callback); }).catch(function (error) { if (error) console.error(error); callback(); @@ -259,7 +259,7 @@ function checkMailStatus(callback) { mail.checkConfiguration(function (error, message) { if (error) return callback(error); - notifications.alert(notifications.ALERT_MAIL_STATUS, message, callback); + notifications.alert(notifications.ALERT_MAIL_STATUS, 'Email is not configured properly', message, callback); }); } @@ -271,7 +271,7 @@ function checkRebootRequired(callback) { isRebootRequired(function (error, rebootRequired) { if (error) return callback(error); - notifications.alert(notifications.ALERT_REBOOT, rebootRequired ? 'To finish security updates, a [reboot](/#/system) is necessary.' : '', callback); + notifications.alert(notifications.ALERT_REBOOT, 'Reboot Required', rebootRequired ? 'To finish security updates, a [reboot](/#/system) is necessary.' : '', callback); }); } diff --git a/src/notifications.js b/src/notifications.js index bf195a6d6..6bc021463 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -36,15 +36,6 @@ let assert = require('assert'), users = require('./users.js'), util = require('util'); -// These titles are matched for upsert -const ALERT_TITLES = { - backupConfig: 'Backup configuration is unsafe', - diskSpace: 'Out of Disk Space', - mailStatus: 'Email is not configured properly', - reboot: 'Reboot Required', - boxUpdate: 'New Cloudron Version Available' -}; - function NotificationsError(reason, errorOrMessage) { assert.strictEqual(typeof reason, 'string'); assert(errorOrMessage instanceof Error || typeof errorOrMessage === 'string' || typeof errorOrMessage === 'undefined'); @@ -335,14 +326,12 @@ function upsert(userId, eventId, title, message, callback) { }); } -function alert(id, message, callback) { +function alert(id, title, message, callback) { assert.strictEqual(typeof id, 'string'); + assert.strictEqual(typeof title, 'string'); assert.strictEqual(typeof message, 'string'); assert.strictEqual(typeof callback, 'function'); - const title = ALERT_TITLES[id]; - if (!title) return callback(); - debug(`alert: id=${id} title=${title} message=${message}`); actionForAllAdmins([], function (admin, callback) { diff --git a/src/updatechecker.js b/src/updatechecker.js index ace0e51b2..f5469c60b 100644 --- a/src/updatechecker.js +++ b/src/updatechecker.js @@ -154,9 +154,9 @@ function checkBoxUpdates(callback) { 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`; + const message = `Changelog:\n${changelog}\n\nClick [here](/#/settings) to update.\n\n`; - notifications.alert(notifications.ALERT_BOX_UPDATE, message, function (error) { + notifications.alert(notifications.ALERT_BOX_UPDATE, `Cloudron v${updateInfo.version} is available`, message, function (error) { if (error) return callback(error); state.box = updateInfo.version;