diff --git a/node/PadMessageHandler.js b/node/PadMessageHandler.js index bd8983971..05440c9b6 100644 --- a/node/PadMessageHandler.js +++ b/node/PadMessageHandler.js @@ -470,6 +470,7 @@ function handleClientReady(client, message) var authorName; var authorColorId; var pad; + var historicalAuthorData = {}; async.series([ //get all authordata of this new user @@ -511,6 +512,20 @@ function handleClientReady(client, message) }); }, function(callback) + { + var authors = pad.getAllAuthors(); + + //get all author data out of the database + async.forEach(authors, function(authorId, callback) + { + authorManager.getAuthor(authorId, function(err, author) + { + historicalAuthorData[authorId] = author; + callback(err); + }); + }, callback); + }, + function(callback) { //Check if this author is already on the pad, if yes, kick the other sessions! if(pad2sessions[message.padId]) @@ -556,7 +571,7 @@ function handleClientReady(client, message) "clientIp": (client.request && client.request.connection) ? client.request.connection.remoteAddress : "127.0.0.1", //"clientAgent": "Anonymous Agent", "padId": message.padId, - "historicalAuthorData": {}, + "historicalAuthorData": historicalAuthorData, "apool": apool, "rev": pad.getHeadRevisionNumber(), "globalPadId": message.padId @@ -570,7 +585,7 @@ function handleClientReady(client, message) "opts": {}, "chatHistory": { "start": 0, - "historicalAuthorData": {}, + "historicalAuthorData": historicalAuthorData, "end": 0, "lines": [] }, @@ -592,16 +607,6 @@ function handleClientReady(client, message) clientVars.userName = authorName; } - //Add all authors that worked on this pad, to the historicalAuthorData on clientVars - var allAuthors = pad.getAllAuthors(); - for(i in allAuthors) - { - clientVars.collab_client_vars.historicalAuthorData[allAuthors[i]] = {}; - if(authorName != null) - clientVars.collab_client_vars.historicalAuthorData[allAuthors[i]].name = authorName; - clientVars.collab_client_vars.historicalAuthorData[allAuthors[i]].colorId = authorColorId; - } - //Send the clientVars to the Client client.send(clientVars);