www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit ed047f06df3226ca9d998cb56d5020b0a1b15f02
parent a4572c94420c73ea154ab9ebfa9ad1e1ae078db7
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed,  8 Feb 2017 21:19:06 -0500

Don't select items added via import

Diffstat:
Mchrome/content/zotero/xpcom/translation/translate.js | 11+++++++----
Mchrome/content/zotero/xpcom/translation/translate_item.js | 12++++++------
2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -2320,10 +2320,13 @@ Zotero.Translate.Import.prototype._prepareTranslation = Zotero.Promise.method(fu } this._itemSaver = new Zotero.Translate.ItemSaver({ - "libraryID":this._libraryID, - "collections": this._collections, - "attachmentMode":Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_FILE" : "ATTACHMENT_MODE_IGNORE")], - "baseURI":baseURI + libraryID: this._libraryID, + collections: this._collections, + attachmentMode: Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_FILE" : "ATTACHMENT_MODE_IGNORE")], + baseURI, + saveOptions: { + skipSelect: true + } }); this.newItems = []; this.newCollections = []; diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -35,6 +35,7 @@ * <li>cookieSandbox - Cookie sandbox for attachment requests</li> * <li>proxy - A proxy to deproxify item URLs</li> * <li>baseURI - URI to which attachment paths should be relative</li> + * <li>saveOptions - Options to pass to DataObject::save() (e.g., skipSelect)</li> */ Zotero.Translate.ItemSaver = function(options) { // initialize constants @@ -66,6 +67,7 @@ Zotero.Translate.ItemSaver = function(options) { getService(Components.interfaces.nsIIOService).newURI(options.baseURI, null, null); } catch(e) {}; } + this._saveOptions = options.saveOptions || {}; }; Zotero.Translate.ItemSaver.ATTACHMENT_MODE_IGNORE = 0; @@ -126,7 +128,7 @@ Zotero.Translate.ItemSaver.prototype = { } // save item - myID = yield newItem.save(); + myID = yield newItem.save(this._saveOptions); // handle notes if (specialFields.notes) { @@ -195,9 +197,7 @@ Zotero.Translate.ItemSaver.prototype = { newCollection.parentID = rootCollectionID; topLevelCollections.push(newCollection) } - yield newCollection.save({ - skipSelect: true - }); + yield newCollection.save(this._saveOptions); var toAdd = []; @@ -307,7 +307,7 @@ Zotero.Translate.ItemSaver.prototype = { if (attachment.tags) newAttachment.setTags(this._cleanTags(attachment.tags)); if (attachment.note) newAttachment.setNote(attachment.note); this._handleRelated(attachment, newAttachment); - yield newAttachment.saveTx(); + yield newAttachment.saveTx(this._saveOptions); Zotero.debug("Translate: Created attachment; id is " + newAttachment.id, 4); attachmentCallback(attachment, 100); @@ -646,7 +646,7 @@ Zotero.Translate.ItemSaver.prototype = { if (!parentItemID && this._collections) { myNote.setCollections(this._collections); } - yield myNote.save(); + yield myNote.save(this._saveOptions); return myNote; }),