remove query admins from mailer code
This commit is contained in:
@@ -21,7 +21,8 @@ var apps = require('./apps.js'),
|
||||
notifications = require('./notifications.js'),
|
||||
paths = require('./paths.js'),
|
||||
safe = require('safetydance'),
|
||||
settings = require('./settings.js');
|
||||
settings = require('./settings.js'),
|
||||
users = require('./users.js');
|
||||
|
||||
var gAppUpdateInfo = { }, // id -> update info { creationDate, manifest }
|
||||
gBoxUpdateInfo = null; // { version, changelog, upgrade, sourceTarballUrl }
|
||||
@@ -107,20 +108,25 @@ function checkAppUpdates(callback) {
|
||||
// always send notifications if user is on the free plan
|
||||
if (appstore.isFreePlan(result)) {
|
||||
debug('Notifying user of app update for %s from %s to %s', app.id, app.manifest.version, updateInfo.manifest.version);
|
||||
mailer.appUpdateAvailable(app, false /* subscription */, updateInfo);
|
||||
return iteratorDone();
|
||||
users.getAllAdmins(function (error, admins) {
|
||||
if (error) return callback(error);
|
||||
|
||||
async.eachSeries(admins, (admin, done) => mailer.appUpdateAvailable(admin.email, app, false /* subscription */, updateInfo, done), iteratorDone);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// only send notifications if update pattern is 'never'
|
||||
settings.getAppAutoupdatePattern(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, true /* hasSubscription */, updateInfo);
|
||||
}
|
||||
if (error) return iteratorDone(error);
|
||||
if (result !== constants.AUTOUPDATE_PATTERN_NEVER) return iteratorDone();
|
||||
|
||||
iteratorDone();
|
||||
debug('Notifying user of app update for %s from %s to %s', app.id, app.manifest.version, updateInfo.manifest.version);
|
||||
users.getAllAdmins(function (error, admins) {
|
||||
if (error) return callback(error);
|
||||
|
||||
async.eachSeries(admins, (admin, done) => mailer.appUpdateAvailable(admin.email, app, true /* subscription */, updateInfo, done), iteratorDone);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user