diff --git a/src/updatechecker.js b/src/updatechecker.js index 4726fd0fc..d63531c88 100644 --- a/src/updatechecker.js +++ b/src/updatechecker.js @@ -198,6 +198,24 @@ function checkBoxUpdates(callback) { gBoxUpdateInfo = updateInfo; + // decide whether to send email + var state = loadState(); + + if (state.box === gBoxUpdateInfo.version) { + debug('Skipping notification of box update as user was already notified'); + return callback(); + } + + if (semver.satisfies(gBoxUpdateInfo.version, '~' + config.version())) { + debug('Skipping notification of box update as this is a patch release'); + } else { + mailer.boxUpdateAvailable(updateInfo.version, updateInfo.changelog); + } + + state.box = updateInfo.version; + + saveState(state); + callback(); }); });