mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
test invalid expiry
This commit is contained in:
@@ -84,13 +84,13 @@ module.exports = function (User) {
|
||||
};
|
||||
|
||||
User.getBannedReason = function (uid, callback) {
|
||||
// Grabs the latest ban reason
|
||||
db.getSortedSetRevRange('banned:' + uid + ':reasons', 0, 0, function (err, reasons) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
callback(null, reasons.length ? reasons[0] : '');
|
||||
});
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
db.getSortedSetRevRange('banned:' + uid + ':reasons', 0, 0, next);
|
||||
},
|
||||
function (reasons, next) {
|
||||
next(null, reasons.length ? reasons[0] : '');
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -827,6 +827,13 @@ describe('User', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should error if until is NaN', function (done) {
|
||||
User.ban(testUid, 'asd', function (err) {
|
||||
assert.equal(err.message, '[[error:ban-expiry-missing]]');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('digests', function () {
|
||||
|
||||
Reference in New Issue
Block a user