simplify quota logic

pull/1/head
ansuz 5 years ago
parent 53ed247bc2
commit b126e4456b

@ -35,12 +35,8 @@ Quota.applyCustomLimits = function (Env) {
};
Quota.updateCachedLimits = function (Env, cb) {
if (Env.adminEmail === false) {
Quota.applyCustomLimits(Env);
if (Env.allowSubscriptions === false) { return; }
if (Env.blockDailyCheck === true) { return; }
throw new Error("allowSubscriptions must be false if adminEmail is false");
}
Quota.applyCustomLimits(Env);
if (Env.allowSubscriptions === false || Env.blockDailyCheck === true) { return void cb(); }
var body = JSON.stringify({
domain: Env.myDomain,
@ -82,8 +78,8 @@ Quota.updateCachedLimits = function (Env, cb) {
req.on('error', function (e) {
Quota.applyCustomLimits(Env);
// FIXME this is always falsey. Maybe we just suppress errors?
if (!Env.domain) { return cb(); }
if (!Env.myDomain) { return cb(); }
// only return an error if your server allows subscriptions
cb(e);
});

Loading…
Cancel
Save