Show correct/new app version info in updated finished notification
This commit is contained in:
@@ -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>(.*)<\/upstream>/i);
|
||||
const tmp = toManifest.description.match(/<upstream>(.*)<\/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:
|
||||
|
||||
Reference in New Issue
Block a user