Skip to content

Commit

Permalink
Hotfix: fixed chat message order on join
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom32i committed Apr 8, 2015
1 parent 9a29e83 commit 72c8b2f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/client/repository/RoomRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,15 @@ RoomRepository.prototype.join = function(name, callback)

this.client.addEvent('room:join', {name: name}, function (result) {
if (result.success) {
var clients = repository.createClients(result.clients),
master = clients.getById(result.master),
room = repository.createRoom(result.room, clients);
var clients = repository.createClients(result.clients),
master = clients.getById(result.master),
room = repository.createRoom(result.room, clients),
messages = result.messages.length;

repository.setRoom(room, clients, master);
callback({success: true, room: room, clients: clients});

for (var m = result.messages.length - 1; m >= 0; m--) {
for (var m = 0; m < messages; m++) {
repository.client.emit('room:talk', result.messages[m]);
}

Expand Down

0 comments on commit 72c8b2f

Please sign in to comment.