From 7dda5a2f69e12def62bd457d352e3507f726ba3c Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 11 Jun 2016 14:54:06 -0400 Subject: [PATCH] Fix saving to collection from fallback search translators Fixes #1028 --- chrome/content/zotero/xpcom/translation/translate.js | 4 +++- test/tests/lookupTest.js | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index bd8396dad7..97fd89d1a1 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1225,6 +1225,7 @@ Zotero.Translate.Base.prototype = { this._libraryID = options.libraryID; this._collections = options.collections; this._saveAttachments = options.saveAttachments === undefined || options.saveAttachments; + this._savingAttachments = []; this._savingItems = 0; this._waitingForSave = false; @@ -2446,7 +2447,8 @@ Zotero.Translate.Search.prototype.complete = function(returnValue, error) { this.translator.shift(); this.translate({ libraryID: this._libraryID, - saveAttachments: this._saveAttachments + saveAttachments: this._saveAttachments, + collections: this._collections }); return; } else { diff --git a/test/tests/lookupTest.js b/test/tests/lookupTest.js index c2a6697302..7033049283 100644 --- a/test/tests/lookupTest.js +++ b/test/tests/lookupTest.js @@ -56,9 +56,16 @@ describe.skip("Add Item by Identifier", function() { var col = yield createDataObject('collection'); yield waitForItemsLoad(win); + // Initial translator var ids = yield lookupIdentifier(win, "10.4103/0976-500X.85940"); var item = Zotero.Items.get(ids[0]); assert.equal(item.getField("title"), "Zotero: A bibliographic assistant to researcher"); assert.isTrue(item.inCollection(col.id)); + + // Fallback translator + var ids = yield lookupIdentifier(win, "10.5281/zenodo.55073"); + var item = Zotero.Items.get(ids[0]); + assert.equal(item.getField("title"), "Comparison of Spectral Methods Through the Adjacency Matrix and the Laplacian of a Graph"); + assert.isTrue(item.inCollection(col.id)); }); }); \ No newline at end of file