mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 00:10:25 +01:00
time based check
This commit is contained in:
@@ -179,19 +179,17 @@ SocketModules.chats.send = function(socket, data, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
Messaging.verifySpammer(socket.uid, function(err, isSpammer) {
|
||||
if (!err && isSpammer) {
|
||||
|
||||
server.in('uid_' + socket.uid).emit('event:banned');
|
||||
|
||||
// We're just logging them out, so a "temporary ban" to prevent abuse. Revisit once we implement a way to temporarily ban users
|
||||
server.logoutUser(socket.uid);
|
||||
return callback();
|
||||
}
|
||||
});
|
||||
|
||||
var msg = S(data.message).stripTags().s;
|
||||
|
||||
var now = Date.now();
|
||||
socket.lastChatMessageTime = socket.lastChatMessageTime || 0;
|
||||
|
||||
if (now - socket.lastChatMessageTime < 200) {
|
||||
return callback(new Error('[[error:too-many-messages]]'));
|
||||
}
|
||||
|
||||
socket.lastChatMessageTime = now;
|
||||
|
||||
user.getUserField(socket.uid, 'banned', function(err, banned) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
Reference in New Issue
Block a user