mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
This commit is contained in:
parent
97b7f0707f
commit
fe6c5e1cfe
1 changed files with 18 additions and 13 deletions
|
@ -853,20 +853,27 @@ function handleClientReady(client, message)
|
||||||
//Run trough all sessions of this pad
|
//Run trough all sessions of this pad
|
||||||
async.forEach(pad2sessions[message.padId], function(sessionID, callback)
|
async.forEach(pad2sessions[message.padId], function(sessionID, callback)
|
||||||
{
|
{
|
||||||
var sessionAuthorName, sessionAuthorColorId;
|
var author, socket, sessionAuthorName, sessionAuthorColorId;
|
||||||
|
|
||||||
|
//Since sessioninfos might change while being enumerated, check if the
|
||||||
|
//sessionID is still assigned to a valid session
|
||||||
|
if(sessioninfos[sessionID] !== undefined &&
|
||||||
|
socketio.sockets.sockets[sessionID] !== undefined){
|
||||||
|
author = sessioninfos[sessionID].author;
|
||||||
|
socket = socketio.sockets.sockets[sessionID];
|
||||||
|
}else {
|
||||||
|
// If the sessionID is not valid, callback();
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
async.series([
|
async.series([
|
||||||
//get the authorname & colorId
|
//get the authorname & colorId
|
||||||
function(callback)
|
function(callback)
|
||||||
{
|
{
|
||||||
if(sessioninfos[sessionID] === undefined){
|
|
||||||
callback();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
async.parallel([
|
async.parallel([
|
||||||
function(callback)
|
function(callback)
|
||||||
{
|
{
|
||||||
authorManager.getAuthorColorId(sessioninfos[sessionID].author, function(err, value)
|
authorManager.getAuthorColorId(author, function(err, value)
|
||||||
{
|
{
|
||||||
if(ERR(err, callback)) return;
|
if(ERR(err, callback)) return;
|
||||||
sessionAuthorColorId = value;
|
sessionAuthorColorId = value;
|
||||||
|
@ -875,7 +882,7 @@ function handleClientReady(client, message)
|
||||||
},
|
},
|
||||||
function(callback)
|
function(callback)
|
||||||
{
|
{
|
||||||
authorManager.getAuthorName(sessioninfos[sessionID].author, function(err, value)
|
authorManager.getAuthorName(author, function(err, value)
|
||||||
{
|
{
|
||||||
if(ERR(err, callback)) return;
|
if(ERR(err, callback)) return;
|
||||||
sessionAuthorName = value;
|
sessionAuthorName = value;
|
||||||
|
@ -887,12 +894,10 @@ function handleClientReady(client, message)
|
||||||
function (callback)
|
function (callback)
|
||||||
{
|
{
|
||||||
//Jump over, if this session is the connection session
|
//Jump over, if this session is the connection session
|
||||||
if(sessionID != client.id &&
|
if(sessionID != client.id)
|
||||||
socketio.sockets.sockets[sessionID] !== undefined &&
|
|
||||||
sessioninfos[sessionID] !== undefined)
|
|
||||||
{
|
{
|
||||||
//Send this Session the Notification about the new user
|
//Send this Session the Notification about the new user
|
||||||
socketio.sockets.sockets[sessionID].json.send(messageToTheOtherUsers);
|
socket.json.send(messageToTheOtherUsers);
|
||||||
|
|
||||||
//Send the new User a Notification about this other user
|
//Send the new User a Notification about this other user
|
||||||
var messageToNotifyTheClientAboutTheOthers = {
|
var messageToNotifyTheClientAboutTheOthers = {
|
||||||
|
@ -904,7 +909,7 @@ function handleClientReady(client, message)
|
||||||
"colorId": sessionAuthorColorId,
|
"colorId": sessionAuthorColorId,
|
||||||
"name": sessionAuthorName,
|
"name": sessionAuthorName,
|
||||||
"userAgent": "Anonymous",
|
"userAgent": "Anonymous",
|
||||||
"userId": sessioninfos[sessionID].author
|
"userId": author
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue