diff --git a/src/updatechecker.js b/src/updatechecker.js index a0dbf9f72..803a8d112 100644 --- a/src/updatechecker.js +++ b/src/updatechecker.js @@ -95,34 +95,34 @@ function checkAppUpdates(callback) { if (oldState[app.id] === newState[app.id]) { debug('Skipping notification of app update %s since user was already notified', app.id); - iteratorDone(); - } else { - settings.getSubscription(function (error, result) { + return iteratorDone(); + } + + settings.getSubscription(function (error, result) { + if (error) { + debug(error); + return iteratorDone(); + } + + // always send notifications if user is on the free plan + if (result.plan.id === 'free' || result.plan.id === 'undecided') { + debug('Notifying user of app update for %s from %s to %s', app.id, app.manifest.version, updateInfo.manifest.version); + mailer.appUpdateAvailable(app, updateInfo); + return iteratorDone(); + } + + // only send notifications if update pattern is 'never' + settings.getAutoupdatePattern(function (error, result) { if (error) { debug(error); - return iteratorDone(); - } - - // always send notifications if user is on the free plan - if (result.plan.id === 'free' || result.plan.id === 'undecided') { + } else if (result === constants.AUTOUPDATE_PATTERN_NEVER) { debug('Notifying user of app update for %s from %s to %s', app.id, app.manifest.version, updateInfo.manifest.version); mailer.appUpdateAvailable(app, updateInfo); - return iteratorDone(); } - // only send notifications if update pattern is 'never' - settings.getAutoupdatePattern(function (error, result) { - if (error) { - debug(error); - } else if (result === constants.AUTOUPDATE_PATTERN_NEVER) { - debug('Notifying user of app update for %s from %s to %s', app.id, app.manifest.version, updateInfo.manifest.version); - mailer.appUpdateAvailable(app, updateInfo); - } - - iteratorDone(); - }); + iteratorDone(); }); - } + }); }); }, function () { newState.box = loadState().box; // preserve the latest box state information