mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-03 19:11:22 +01:00
exists function fix
This commit is contained in:
@@ -299,14 +299,12 @@ var config = require('../config.js'),
|
||||
}
|
||||
|
||||
|
||||
User.exists = function(socket, username, callback) {
|
||||
User.exists = function(username, callback) {
|
||||
User.get_uid_by_username(username, function(exists) {
|
||||
exists = !!exists;
|
||||
|
||||
if (callback)
|
||||
callback(exists);
|
||||
else
|
||||
socket.emit('user.exists', {exists: exists});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -124,7 +124,9 @@ var SocketIO = require('socket.io').listen(global.server,{log:false}),
|
||||
});
|
||||
|
||||
socket.on('user.exists', function(data) {
|
||||
modules.user.exists(socket, data.username);
|
||||
modules.user.exists(data.username, function(exists){
|
||||
socket.emit('user.exists', {exists: exists});
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('user.count', function(data) {
|
||||
|
||||
Reference in New Issue
Block a user