mirror of
https://github.com/zotero/zotero.git
synced 2026-10-08 03:08:19 +00:00
Don't modify options object passed to DataObject.save()
This commit is contained in:
parent
835003dd6d
commit
4871374673
1 changed files with 7 additions and 6 deletions
|
|
@ -790,10 +790,9 @@ Zotero.DataObject.prototype.editCheck = function () {
|
|||
* @return {Promise<Integer|Boolean>} Promise for itemID of new item,
|
||||
* TRUE on item update, or FALSE if item was unchanged
|
||||
*/
|
||||
Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options) {
|
||||
options = options || {};
|
||||
Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options = {}) {
|
||||
var env = {
|
||||
options: options,
|
||||
options: Object.assign({}, options),
|
||||
transactionOptions: {}
|
||||
};
|
||||
|
||||
|
|
@ -880,8 +879,8 @@ Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options)
|
|||
});
|
||||
|
||||
|
||||
Zotero.DataObject.prototype.saveTx = function (options) {
|
||||
options = options || {};
|
||||
Zotero.DataObject.prototype.saveTx = function (options = {}) {
|
||||
options = Object.assign({}, options);
|
||||
options.tx = true;
|
||||
return this.save(options);
|
||||
}
|
||||
|
|
@ -1129,7 +1128,9 @@ Zotero.DataObject.prototype.erase = Zotero.Promise.coroutine(function* (options
|
|||
throw new Error("'options' must be an object");
|
||||
}
|
||||
|
||||
var env = { options };
|
||||
var env = {
|
||||
options: Object.assign({}, options)
|
||||
};
|
||||
|
||||
if (!env.options.tx && !Zotero.DB.inTransaction()) {
|
||||
Zotero.logError("erase() called on Zotero." + this._ObjectType + " without a wrapping "
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue