Don't unload object on save error if not new

This commit is contained in:
Dan Stillman 2017-02-02 22:34:12 -05:00
parent 79a07cad9e
commit 76bc61e882

View file

@ -909,14 +909,16 @@ Zotero.DataObject.prototype._initSave = Zotero.Promise.coroutine(function* (env)
} }
// Undo registerObject() on failure // Undo registerObject() on failure
var func = function () { if (env.isNew) {
this.ObjectsClass.unload(this._id); var func = function () {
}.bind(this); this.ObjectsClass.unload(this._id);
if (env.options.tx) { }.bind(this);
env.transactionOptions.onRollback = func; if (env.options.tx) {
} env.transactionOptions.onRollback = func;
else { }
Zotero.DB.addCurrentCallback("rollback", func); else {
Zotero.DB.addCurrentCallback("rollback", func);
}
} }
env.relationsToRegister = []; env.relationsToRegister = [];