Prettify session handling in handleUserChanges
Also add a comment to explain what's going on with thisSession. No changes in behavior.pull/1025/head
parent
f1b4206cad
commit
7aaef01346
|
@ -465,7 +465,9 @@ function handleUserChanges(client, message)
|
||||||
var baseRev = message.data.baseRev;
|
var baseRev = message.data.baseRev;
|
||||||
var wireApool = (new AttributePool()).fromJsonable(message.data.apool);
|
var wireApool = (new AttributePool()).fromJsonable(message.data.apool);
|
||||||
var changeset = message.data.changeset;
|
var changeset = message.data.changeset;
|
||||||
var thisAuthor = sessioninfos[client.id].author;
|
// The client might disconnect between our callbacks. We should still
|
||||||
|
// finish processing the changeset, so keep a reference to the session.
|
||||||
|
var thisSession = sessioninfos[client.id];
|
||||||
|
|
||||||
var r, apool, pad;
|
var r, apool, pad;
|
||||||
|
|
||||||
|
@ -473,7 +475,7 @@ function handleUserChanges(client, message)
|
||||||
//get the pad
|
//get the pad
|
||||||
function(callback)
|
function(callback)
|
||||||
{
|
{
|
||||||
padManager.getPad(sessioninfos[client.id].padId, function(err, value)
|
padManager.getPad(thisSession.padId, function(err, value)
|
||||||
{
|
{
|
||||||
if(ERR(err, callback)) return;
|
if(ERR(err, callback)) return;
|
||||||
pad = value;
|
pad = value;
|
||||||
|
@ -550,7 +552,7 @@ function handleUserChanges(client, message)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pad.appendRevision(changeset, thisAuthor);
|
pad.appendRevision(changeset, thisSession.author);
|
||||||
|
|
||||||
var correctionChangeset = _correctMarkersInPad(pad.atext, pad.pool);
|
var correctionChangeset = _correctMarkersInPad(pad.atext, pad.pool);
|
||||||
if (correctionChangeset) {
|
if (correctionChangeset) {
|
||||||
|
|
Loading…
Reference in New Issue