From 29e87ac984b7f04d777cc7960c2b7f510db5f040 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sat, 26 Dec 2015 08:41:03 +0200 Subject: [PATCH] fix initial room creation --- src/messaging/rooms.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/messaging/rooms.js b/src/messaging/rooms.js index 4f8c9861db..a01e47b034 100644 --- a/src/messaging/rooms.js +++ b/src/messaging/rooms.js @@ -37,7 +37,10 @@ module.exports = function(Messaging) { db.setObject('chat:room:' + roomId, room, next); }, function (next) { - Messaging.addUsersToRoom(uid, [uid].concat(toUids), roomId, next); + db.sortedSetAdd('chat:room:' + roomId + ':uids', now, uid, next); + }, + function (next) { + Messaging.addUsersToRoom(uid, toUids, roomId, next); }, function (next) { Messaging.addRoomToUsers(roomId, [uid].concat(toUids), now, next); @@ -98,7 +101,7 @@ module.exports = function(Messaging) { }, function (results, next) { if (!results.isOwner) { - return next(new Error('[[error:cant-add-users-to-chat-room]]')); + return next(new Error('[[error:cant-remove-users-to-chat-room]]')); } if (results.userCount === 2) { return next(new Error('[[error:cant-remove-last-user]]'));