Fixed the author color Bug
parent
d547623e05
commit
a4627a4b6d
|
@ -470,6 +470,7 @@ function handleClientReady(client, message)
|
||||||
var authorName;
|
var authorName;
|
||||||
var authorColorId;
|
var authorColorId;
|
||||||
var pad;
|
var pad;
|
||||||
|
var historicalAuthorData = {};
|
||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
//get all authordata of this new user
|
//get all authordata of this new user
|
||||||
|
@ -511,6 +512,20 @@ function handleClientReady(client, message)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(callback)
|
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!
|
//Check if this author is already on the pad, if yes, kick the other sessions!
|
||||||
if(pad2sessions[message.padId])
|
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",
|
"clientIp": (client.request && client.request.connection) ? client.request.connection.remoteAddress : "127.0.0.1",
|
||||||
//"clientAgent": "Anonymous Agent",
|
//"clientAgent": "Anonymous Agent",
|
||||||
"padId": message.padId,
|
"padId": message.padId,
|
||||||
"historicalAuthorData": {},
|
"historicalAuthorData": historicalAuthorData,
|
||||||
"apool": apool,
|
"apool": apool,
|
||||||
"rev": pad.getHeadRevisionNumber(),
|
"rev": pad.getHeadRevisionNumber(),
|
||||||
"globalPadId": message.padId
|
"globalPadId": message.padId
|
||||||
|
@ -570,7 +585,7 @@ function handleClientReady(client, message)
|
||||||
"opts": {},
|
"opts": {},
|
||||||
"chatHistory": {
|
"chatHistory": {
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"historicalAuthorData": {},
|
"historicalAuthorData": historicalAuthorData,
|
||||||
"end": 0,
|
"end": 0,
|
||||||
"lines": []
|
"lines": []
|
||||||
},
|
},
|
||||||
|
@ -592,16 +607,6 @@ function handleClientReady(client, message)
|
||||||
clientVars.userName = authorName;
|
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
|
//Send the clientVars to the Client
|
||||||
client.send(clientVars);
|
client.send(clientVars);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue