diff --git a/src/appdb.js b/src/appdb.js index c16f8e25c..5760e34fb 100644 --- a/src/appdb.js +++ b/src/appdb.js @@ -32,7 +32,6 @@ exports = module.exports = { ISTATE_PENDING_UNINSTALL: 'pending_uninstall', // uninstallation ISTATE_PENDING_RESTORE: 'pending_restore', // restore to previous backup or on upgrade ISTATE_PENDING_UPDATE: 'pending_update', // update from installed state preserving data - ISTATE_PENDING_FORCE_UPDATE: 'pending_force_update', // update from any state preserving data ISTATE_PENDING_BACKUP: 'pending_backup', // backup the app ISTATE_ERROR: 'error', // error executing last pending_* command ISTATE_INSTALLED: 'installed', // app is installed diff --git a/src/apps.js b/src/apps.js index b38460ba5..b37f2d581 100644 --- a/src/apps.js +++ b/src/apps.js @@ -902,7 +902,10 @@ function update(appId, data, auditSource, callback) { downloadManifest(data.appStoreId, data.manifest, function (error, appStoreId, manifest) { if (error) return callback(error); - var updateConfig = { }; + var updateConfig = { + skipNotification: data.force, + skipBackup: data.force + }; error = manifestFormat.parse(manifest); if (error) return callback(new AppsError(AppsError.BAD_FIELD, 'Manifest error:' + error.message)); @@ -948,7 +951,7 @@ function update(appId, data, auditSource, callback) { updateConfig.memoryLimit = updateConfig.manifest.memoryLimit; } - appdb.setInstallationCommand(appId, data.force ? appdb.ISTATE_PENDING_FORCE_UPDATE : appdb.ISTATE_PENDING_UPDATE, { }, function (error) { + appdb.setInstallationCommand(appId, appdb.ISTATE_PENDING_UPDATE, { }, function (error) { if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new AppsError(AppsError.BAD_STATE)); // might be a bad guess if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error)); diff --git a/src/apptask.js b/src/apptask.js index 91abc989e..0cecff4b4 100644 --- a/src/apptask.js +++ b/src/apptask.js @@ -715,8 +715,6 @@ function update(app, updateConfig, progressCallback, callback) { // FIXME: this does not handle option changes (like multipleDatabases) var unusedAddons = _.omit(app.manifest.addons, Object.keys(updateConfig.manifest.addons)); - const FORCED_UPDATE = (app.installationState === appdb.ISTATE_PENDING_FORCE_UPDATE); - async.series([ // this protects against the theoretical possibility of an app being marked for update from // a previous version of box code @@ -724,7 +722,7 @@ function update(app, updateConfig, progressCallback, callback) { verifyManifest.bind(null, updateConfig.manifest), function (next) { - if (FORCED_UPDATE) return next(null); + if (updateConfig.skipBackup) return next(null); async.series([ progressCallback.bind(null, { percent: 15, message: 'Backing up app' }), @@ -810,8 +808,7 @@ function update(app, updateConfig, progressCallback, callback) { debugApp(app, 'Error updating app: %s', error); updateApp(app, { installationState: appdb.ISTATE_ERROR, errorMessage: error.message, updateTime: new Date() }, callback.bind(null, error)); } else { - // do not spam the notifcation view - if (FORCED_UPDATE) return callback(); + if (updateConfig.skipNotification) return callback(); eventlog.add(eventlog.ACTION_APP_UPDATE_FINISH, auditsource.APP_TASK, { app: app, success: true }, callback); } @@ -929,7 +926,6 @@ function run(appId, args, progressCallback, callback) { case appdb.ISTATE_PENDING_CLONE: return install(app, args.restoreConfig || {}, progressCallback, callback); case appdb.ISTATE_PENDING_RESTORE: return install(app, args.restoreConfig || {}, progressCallback, callback); case appdb.ISTATE_PENDING_UPDATE: return update(app, args.updateConfig, progressCallback, callback); - case appdb.ISTATE_PENDING_FORCE_UPDATE: return update(app, args.updateConfig, progressCallback, callback); case appdb.ISTATE_PENDING_BACKUP: return backup(app, progressCallback, callback); case appdb.ISTATE_INSTALLED: return handleRunCommand(app, progressCallback, callback);