www

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

commit 3241faf50314d3f2646657d11e25dfa2ff71a650
parent 2f620c5f91fcf88c88a1888041de3d0a1a8fc1e9
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 23 May 2018 20:39:32 -0400

Fix tag saving for intercepted imports from connector

Save tags in intercepted files as automatic tags

Diffstat:
Mchrome/content/zotero/xpcom/connector/server_connector.js | 1+
Mchrome/content/zotero/xpcom/translation/translate.js | 2++
Mtest/tests/server_connectorTest.js | 5++++-
3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/connector/server_connector.js b/chrome/content/zotero/xpcom/connector/server_connector.js @@ -1002,6 +1002,7 @@ Zotero.Server.Connector.Import.prototype = { let items = await translate.translate({ libraryID, collections: collection ? [collection.id] : null, + forceTagType: 1, // Import translation skips selection by default, so force it to occur saveOptions: { skipSelect: false diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -1299,6 +1299,7 @@ Zotero.Translate.Base.prototype = { } this._collections = options.collections; this._saveAttachments = options.saveAttachments === undefined || options.saveAttachments; + this._forceTagType = options.forceTagType; this._saveOptions = options.saveOptions; this._savingAttachments = []; @@ -2378,6 +2379,7 @@ Zotero.Translate.Import.prototype._prepareTranslation = Zotero.Promise.method(fu this._itemSaver = new Zotero.Translate.ItemSaver({ libraryID: this._libraryID, collections: this._collections, + forceTagType: this._forceTagType, attachmentMode: Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_FILE" : "ATTACHMENT_MODE_IGNORE")], baseURI, saveOptions: Object.assign( diff --git a/test/tests/server_connectorTest.js b/test/tests/server_connectorTest.js @@ -731,7 +731,8 @@ describe("Connector Server", function () { title={Test1}, author={Owl}, year={1000}, - publisher={Curly Braces Publishing} + publisher={Curly Braces Publishing}, + keywords={A, B} }`; var addedItemIDsPromise = waitForItemEvent('add'); @@ -748,6 +749,8 @@ describe("Connector Server", function () { let itemIDs = yield addedItemIDsPromise; assert.isTrue(collection.hasItem(itemIDs[0])); + var item = Zotero.Items.get(itemIDs[0]); + assert.sameDeepMembers(item.getTags(), [{ tag: 'A', type: 1 }, { tag: 'B', type: 1 }]); });