mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
closes #3997
This commit is contained in:
@@ -125,6 +125,8 @@ SocketModules.chats.loadRoom = function(socket, data, callback) {
|
||||
function (results, next) {
|
||||
results.roomData.users = results.users;
|
||||
results.roomData.isOwner = parseInt(results.roomData.owner, 10) === socket.uid;
|
||||
results.roomData.maximumUsersInChatRoom = parseInt(meta.config.maximumUsersInChatRoom, 10) || 0;
|
||||
results.roomData.showUserInput = !results.roomData.maximumUsersInChatRoom || results.roomData.maximumUsersInChatRoom > 2;
|
||||
next(null, results.roomData);
|
||||
}
|
||||
], callback);
|
||||
@@ -135,6 +137,16 @@ SocketModules.chats.addUserToRoom = function(socket, data, callback) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
Messaging.getUserCountInRoom(data.roomId, next);
|
||||
},
|
||||
function (userCount, next) {
|
||||
var maxUsers = parseInt(meta.config.maximumUsersInChatRoom, 10) || 0;
|
||||
if (maxUsers && userCount >= maxUsers) {
|
||||
return next(new Error('[[error:cant-add-more-users-to-chat-room]]'));
|
||||
}
|
||||
next();
|
||||
},
|
||||
function (next) {
|
||||
user.getUidByUsername(data.username, next);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user