handle bad changesets

pull/108/merge
Peter 'Pita' Martischka 2011-08-20 18:51:43 +01:00
parent 42662d73d0
commit b9f23fa208
1 changed files with 18 additions and 6 deletions

View File

@ -382,12 +382,24 @@ function handleUserChanges(client, message)
//ex. _checkChangesetAndPool
//Copied from Etherpad, don't know what it does exactly
Changeset.checkRep(changeset);
Changeset.eachAttribNumber(changeset, function(n) {
if (! wireApool.getAttrib(n)) {
throw "Attribute pool is missing attribute "+n+" for changeset "+changeset;
}
});
try
{
//this looks like a changeset check, it throws errors sometimes
Changeset.checkRep(changeset);
Changeset.eachAttribNumber(changeset, function(n) {
if (! wireApool.getAttrib(n)) {
throw "Attribute pool is missing attribute "+n+" for changeset "+changeset;
}
});
}
//there is an error in this changeset, so just refuse it
catch(e)
{
console.warn("Can't apply USER_CHANGES "+changeset+", cause it faild checkRep");
client.json.send({disconnect:"badChangeset"});
return;
}
//ex. adoptChangesetAttribs