From 69b53b158384ce5b2bfcb043835c7717ebd8bfb1 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 10 Jul 2011 18:02:09 +0000 Subject: [PATCH] Closes #1860, Scaffold can't safely test collection creation Zotero.Translate#translate(false) should no longer create collections. There was already a collectionDone event; it now gets the unprocessed collection object when false is passed to Zotero.Translate#translate. --- chrome/content/zotero/xpcom/translation/translate.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 6782b664a5..4cff7be01a 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -552,8 +552,14 @@ Zotero.Translate.Sandbox = { * @param {SandboxCollection} collection */ "_collectionDone":function(translate, collection) { - var newCollection = translate._itemSaver.saveCollection(collection); - translate._runHandler("collectionDone", newCollection); + if(this._libraryID == false) { + this.newCollections.push(collection); + translate._runHandler("collectionDone", collection); + } else { + var newCollection = translate._itemSaver.saveCollection(collection); + this.newCollections.push(newCollection); + translate._runHandler("collectionDone", newCollection); + } }, /** @@ -1587,7 +1593,7 @@ Zotero.Translate.Import.prototype._prepareTranslation = function() { this._itemSaver = new Zotero.Translate.ItemSaver(this._libraryID, Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_FILE" : "ATTACHMENT_MODE_IGNORE")]); this.newItems = []; - this.newCollections = this._itemSaver.newCollections; + this.newCollections = []; } Zotero.Translate.Import.prototype.__defineGetter__("progress",