diff --git a/src/apps.js b/src/apps.js index d8251b299..2a2fc46ea 100644 --- a/src/apps.js +++ b/src/apps.js @@ -1358,7 +1358,7 @@ function update(app, data, auditSource, callback) { args: { updateConfig }, values, onFinished: (error) => { - eventlog.add(eventlog.ACTION_APP_UPDATE_FINISH, auditSource, { app, success: !error, errorMessage: error ? error.message : null }); + eventlog.add(eventlog.ACTION_APP_UPDATE_FINISH, auditSource, { app, toManifest: manifest, fromManifest: app.manifest, success: !error, errorMessage: error ? error.message : null }); } }; addTask(appId, exports.ISTATE_PENDING_UPDATE, task, function (error, result) { diff --git a/src/notifications.js b/src/notifications.js index e0eb63466..84c5f4e4a 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -140,18 +140,20 @@ async function oomEvent(eventId, app, addon, containerId /*, event*/) { await add(eventId, title, message); } -async function appUpdated(eventId, app) { +async function appUpdated(eventId, app, fromManifest, toManifest) { assert.strictEqual(typeof eventId, 'string'); assert.strictEqual(typeof app, 'object'); + assert.strictEqual(typeof fromManifest, 'object'); + assert.strictEqual(typeof toManifest, 'object'); if (!app.appStoreId) return; // skip notification of dev apps - const tmp = app.manifest.description.match(/(.*)<\/upstream>/i); + const tmp = toManifest.description.match(/(.*)<\/upstream>/i); const upstreamVersion = (tmp && tmp[1]) ? tmp[1] : ''; - const title = upstreamVersion ? `${app.manifest.title} at ${app.fqdn} updated to ${upstreamVersion} (package version ${app.manifest.version})` - : `${app.manifest.title} at ${app.fqdn} updated to package version ${app.manifest.version}`; + const title = upstreamVersion ? `${toManifest.title} at ${app.fqdn} updated to ${upstreamVersion} (package version ${toManifest.version})` + : `${toManifest.title} at ${app.fqdn} updated to package version ${toManifest.version}`; - await add(eventId, title, `The application installed at https://${app.fqdn} was updated.\n\nChangelog:\n${app.manifest.changelog}\n`); + await add(eventId, title, `The application installed at https://${app.fqdn} was updated.\n\nChangelog:\n${toManifest.changelog}\n`); } async function boxUpdated(eventId, oldVersion, newVersion) { @@ -250,7 +252,7 @@ async function onEvent(id, action, source, data) { case eventlog.ACTION_APP_UPDATE_FINISH: if (source.username !== auditSource.CRON.username) return; // updated by user if (data.errorMessage) return; // the update indicator will still appear, so no need to notify user - return await appUpdated(id, data.app); + return await appUpdated(id, data.app, data.fromManifest, data.toManifest); case eventlog.ACTION_CERTIFICATE_RENEWAL: case eventlog.ACTION_CERTIFICATE_NEW: