Skip to content

Commit

Permalink
Don't select items added via import
Browse files Browse the repository at this point in the history
  • Loading branch information
dstillman committed Feb 9, 2017
1 parent a4572c9 commit ed047f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 7 additions & 4 deletions chrome/content/zotero/xpcom/translation/translate.js
Expand Up @@ -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 = [];
Expand Down
12 changes: 6 additions & 6 deletions chrome/content/zotero/xpcom/translation/translate_item.js
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 = [];

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}),

Expand Down

0 comments on commit ed047f0

Please sign in to comment.