v1.18.x
barisusakli 10 years ago
parent 181e2b4132
commit c24e451c12

@ -141,15 +141,19 @@ SocketModules.chats.send = function(socket, data, callback) {
socket.lastChatMessageTime = now;
user.getUserField(socket.uid, 'banned', function(err, banned) {
user.getUserFields(socket.uid, ['banned', 'email:confirmed'], function(err, userData) {
if (err) {
return callback(err);
}
if (parseInt(banned, 10) === 1) {
if (parseInt(userData.banned, 10) === 1) {
return callback(new Error('[[error:user-banned]]'));
}
if (parseInt(meta.config.requireEmailConfirmation, 10) === 1 && parseInt(userData['email:confirmed'], 10) !== 1) {
return callback(new Error('[[error:email-not-confirmed]]'));
}
Messaging.canMessage(socket.uid, touid, function(err, allowed) {
if (err || !allowed) {
return callback(err || new Error('[[error:chat-restricted]]'));

@ -175,7 +175,7 @@ var async = require('async'),
return callback(new Error('[[error:user-banned]]'));
}
if (userData.email && parseInt(meta.config.requireEmailConfirmation, 10) === 1 && parseInt(userData['email:confirmed'], 10) !== 1) {
if (parseInt(meta.config.requireEmailConfirmation, 10) === 1 && parseInt(userData['email:confirmed'], 10) !== 1) {
return callback(new Error('[[error:email-not-confirmed]]'));
}
var now = Date.now();

Loading…
Cancel
Save