This commit is contained in:
barisusakli
2016-01-08 12:34:09 +02:00
parent cbcae33173
commit 18013c5518
3 changed files with 36 additions and 1 deletions

View File

@@ -101,12 +101,19 @@ module.exports = function(Messaging) {
},
function (results, next) {
if (!results.isOwner) {
return next(new Error('[[error:cant-remove-users-to-chat-room]]'));
return next(new Error('[[error:cant-remove-users-from-chat-room]]'));
}
if (results.userCount === 2) {
return next(new Error('[[error:cant-remove-last-user]]'));
}
Messaging.leaveRoom(uids, roomId, next);
}
], callback);
};
Messaging.leaveRoom = function(uids, roomId, callback) {
async.waterfall([
function (next) {
db.sortedSetRemove('chat:room:' + roomId + ':uids', uids, next);
},
function (next) {