mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
Only create clientVars when they are needed
This commit is contained in:
parent
025c92f346
commit
94f9b05c4c
1 changed files with 64 additions and 65 deletions
|
@ -991,6 +991,15 @@ function handleClientReady(client, message)
|
||||||
//Saves in pad2sessions that this session belongs to this pad
|
//Saves in pad2sessions that this session belongs to this pad
|
||||||
pad2sessions[padIds.padId].push(client.id);
|
pad2sessions[padIds.padId].push(client.id);
|
||||||
|
|
||||||
|
//If this is a reconnect, we don't have to send the client the ClientVars again
|
||||||
|
if(message.reconnect == true)
|
||||||
|
{
|
||||||
|
//Save the revision in sessioninfos, we take the revision from the info the client send to us
|
||||||
|
sessioninfos[client.id].rev = message.client_rev;
|
||||||
|
}
|
||||||
|
//This is a normal first connect
|
||||||
|
else
|
||||||
|
{
|
||||||
//prepare all values for the wire
|
//prepare all values for the wire
|
||||||
var atext = Changeset.cloneAText(pad.atext);
|
var atext = Changeset.cloneAText(pad.atext);
|
||||||
var attribsForWire = Changeset.prepareForWire(atext.attribs, pad.pool);
|
var attribsForWire = Changeset.prepareForWire(atext.attribs, pad.pool);
|
||||||
|
@ -1012,7 +1021,6 @@ function handleClientReady(client, message)
|
||||||
"collab_client_vars": {
|
"collab_client_vars": {
|
||||||
"initialAttributedText": atext,
|
"initialAttributedText": atext,
|
||||||
"clientIp": "127.0.0.1",
|
"clientIp": "127.0.0.1",
|
||||||
//"clientAgent": "Anonymous Agent",
|
|
||||||
"padId": message.padId,
|
"padId": message.padId,
|
||||||
"historicalAuthorData": historicalAuthorData,
|
"historicalAuthorData": historicalAuthorData,
|
||||||
"apool": apool,
|
"apool": apool,
|
||||||
|
@ -1055,15 +1063,6 @@ function handleClientReady(client, message)
|
||||||
clientVars.userName = authorName;
|
clientVars.userName = authorName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If this is a reconnect, we don't have to send the client the ClientVars again
|
|
||||||
if(message.reconnect == true)
|
|
||||||
{
|
|
||||||
//Save the revision in sessioninfos, we take the revision from the info the client send to us
|
|
||||||
sessioninfos[client.id].rev = message.client_rev;
|
|
||||||
}
|
|
||||||
//This is a normal first connect
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Send the clientVars to the Client
|
//Send the clientVars to the Client
|
||||||
client.json.send({type: "CLIENT_VARS", data: clientVars});
|
client.json.send({type: "CLIENT_VARS", data: clientVars});
|
||||||
//Save the current revision in sessioninfos, should be the same as in clientVars
|
//Save the current revision in sessioninfos, should be the same as in clientVars
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue