mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-30 19:30:04 +01:00
Merge pull request #4250 from pichalite/issue-4228
throw error in chat if no users in room
This commit is contained in:
@@ -124,5 +124,6 @@
|
||||
"invite-maximum-met": "You have invited the maximum amount of people (%1 out of %2).",
|
||||
|
||||
"no-session-found": "No login session found!",
|
||||
"not-in-room": "User not in room"
|
||||
"not-in-room": "User not in room",
|
||||
"no-users-in-room": "No users in this room"
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ var async = require('async'),
|
||||
if (parseInt(meta.config.disableChat) === 1 || !uid) {
|
||||
return callback(new Error('[[error:chat-disabled]]'));
|
||||
}
|
||||
|
||||
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
Messaging.isUserInRoom(uid, roomId, next);
|
||||
@@ -368,6 +368,14 @@ var async = require('async'),
|
||||
if (!inRoom) {
|
||||
return next(new Error('[[error:not-in-room]]'));
|
||||
}
|
||||
|
||||
Messaging.getUserCountInRoom(roomId, next);
|
||||
},
|
||||
function(count, next) {
|
||||
if (count < 2) {
|
||||
return next(new Error('[[error:no-users-in-room]]'));
|
||||
}
|
||||
|
||||
user.getUserFields(uid, ['banned', 'email:confirmed'], next);
|
||||
},
|
||||
function (userData, next) {
|
||||
|
||||
Reference in New Issue
Block a user