diff --git a/src/updatechecker.js b/src/updatechecker.js index 0db2ddfb0..d87e087e7 100644 --- a/src/updatechecker.js +++ b/src/updatechecker.js @@ -35,7 +35,7 @@ function checkAppUpdates(options, callback) { assert.strictEqual(typeof options, 'object'); assert.strictEqual(typeof callback, 'function'); - debug('Checking App Updates'); + debug('checkAppUpdates: checking for updates'); let state = getUpdateInfo(); let newState = { }; // create new state so that old app ids are removed @@ -50,7 +50,7 @@ function checkAppUpdates(options, callback) { appstore.getAppUpdate(app, options, function (error, updateInfo) { if (error) { - debug('Error getting app update info for %s', app.id, error); + debug('checkAppUpdates: Error getting app update info for %s', app.id, error); return iteratorDone(); // continue to next } @@ -59,10 +59,12 @@ function checkAppUpdates(options, callback) { newState[app.id] = updateInfo; if (safe.query(state[app.id], 'manifest.version') === updateInfo.manifest.version) { - debug(`Skipping app update notification of ${app.id} since user was already notified of ${updateInfo.manifest.version}`); + debug(`checkAppUpdates: Skipping app update notification of ${app.id} since user was already notified of ${updateInfo.manifest.version}`); return iteratorDone(); } + debug(`checkAppUpdates: ${app.id} can be updated to ${updateInfo.manifest.id}@${updateInfo.manifest.version}`); + pendingNotifications.push({ app, updateInfo }); iteratorDone(); }); @@ -80,7 +82,7 @@ function checkBoxUpdates(options, callback) { assert.strictEqual(typeof options, 'object'); assert.strictEqual(typeof callback, 'function'); - debug('Checking Box Updates'); + debug('checkBoxUpdates: checking for updates'); appstore.getBoxUpdate(options, function (error, updateInfo) { if (error) return callback(error); @@ -92,14 +94,17 @@ function checkBoxUpdates(options, callback) { delete state.box; setUpdateInfo(state); } + debug('checkBoxUpdates: no updates'); return callback(null); } if (state.box && state.box.version === updateInfo.version) { - debug('Skipping notification of box update as user was already notified'); + debug(`checkBoxUpdates: Skipping notification of box update ${updateInfo.version} as user was already notified`); return callback(); } + debug(`checkBoxUpdates: ${updateInfo.version} is available`); + const changelog = updateInfo.changelog.map((m) => `* ${m}\n`).join(''); const message = `Changelog:\n${changelog}\n\nGo to the settings view to update.\n\n`;