Pass fixGaps to Zotero.Search.save() in an options object

This commit is contained in:
Aurimas Vinckevicius 2014-11-01 19:18:14 -05:00
parent e02945b591
commit f7220378dd
3 changed files with 2 additions and 12 deletions

View File

@ -232,7 +232,7 @@
<body> <body>
<![CDATA[ <![CDATA[
this.updateSearch(); this.updateSearch();
return this.search.save(true); return this.search.save({fixGaps: true});
]]> ]]>
</body> </body>
</method> </method>

View File

@ -445,7 +445,6 @@ Zotero.DataObject.prototype.editCheck = function () {
*/ */
Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options) { Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options) {
var env = { var env = {
arguments: arguments,
transactionOptions: null, transactionOptions: null,
options: options || {} options: options || {}
}; };

View File

@ -181,17 +181,8 @@ Zotero.Search.prototype._initSave = Zotero.Promise.coroutine(function* (env) {
return Zotero.Search._super.prototype._initSave.apply(this, arguments); return Zotero.Search._super.prototype._initSave.apply(this, arguments);
}); });
/*
* Save the search to the DB and return a savedSearchID
*
* If there are gaps in the searchConditionIDs, |fixGaps| must be true
* and the caller must dispose of the search or reload the condition ids,
* which may change after the save.
*
* For new searches, name must be set called before saving
*/
Zotero.Search.prototype._saveData = Zotero.Promise.coroutine(function* (env) { Zotero.Search.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
var fixGaps = env.arguments[0]; var fixGaps = env.options.fixGaps;
var isNew = env.isNew; var isNew = env.isNew;
var searchID = env.id = this._id = this.id ? this.id : yield Zotero.ID.get('savedSearches'); var searchID = env.id = this._id = this.id ? this.id : yield Zotero.ID.get('savedSearches');