temporary ban support

This commit is contained in:
Julian Lam
2016-06-29 12:07:23 -04:00
parent 585a90db5d
commit 04d4fc2eca
4 changed files with 51 additions and 11 deletions

View File

@@ -71,6 +71,8 @@ module.exports = function(User) {
if (until > 0 && Date.now() < until) {
tasks.push(async.apply(db.sortedSetAdd, 'users:banned:expire', until, uid));
} else {
until = 0;
}
async.series(tasks, function (err) {
@@ -78,7 +80,10 @@ module.exports = function(User) {
return callback(err);
}
plugins.fireHook('action:user.banned', {uid: uid});
plugins.fireHook('action:user.banned', {
uid: uid,
until: until > 0 ? until : undefined
});
callback();
});
};