mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 02:25:55 +01:00
feat: update unban logic/invocation and refactor User.bans module
* auto unban when User.getUsersFields is called and the user is banned but has expired * cleanups and removal of expiry_readable * expiry_readable make an alias for backward compatibility * User.bans.func vs User.*ban*Func * console.log cleanups, plus todo message added * use code util.deprecate * fix: remove ununsed winston require
This commit is contained in:
@@ -132,8 +132,8 @@ describe('socket.io', function () {
|
||||
assert.ifError(err);
|
||||
assert(data.uid);
|
||||
assert(data.timestamp);
|
||||
assert(data.hasOwnProperty('expiry'));
|
||||
assert(data.hasOwnProperty('expiry_readable'));
|
||||
assert(data.hasOwnProperty('banned_until'));
|
||||
assert(data.hasOwnProperty('banned_until_readable'));
|
||||
assert.equal(data.reason, 'spammer');
|
||||
done();
|
||||
});
|
||||
@@ -141,7 +141,7 @@ describe('socket.io', function () {
|
||||
});
|
||||
|
||||
it('should return ban reason', function (done) {
|
||||
user.getBannedReason(regularUid, function (err, reason) {
|
||||
user.bans.getReason(regularUid, function (err, reason) {
|
||||
assert.ifError(err);
|
||||
assert.equal(reason, 'spammer');
|
||||
done();
|
||||
@@ -152,7 +152,7 @@ describe('socket.io', function () {
|
||||
var socketUser = require('../src/socket.io/user');
|
||||
socketUser.unbanUsers({ uid: adminUid }, [regularUid], function (err) {
|
||||
assert.ifError(err);
|
||||
user.isBanned(regularUid, function (err, isBanned) {
|
||||
user.bans.isBanned(regularUid, function (err, isBanned) {
|
||||
assert.ifError(err);
|
||||
assert(!isBanned);
|
||||
done();
|
||||
|
||||
Reference in New Issue
Block a user