Fix tag saving for intercepted imports from connector

Save tags in intercepted files as automatic tags
This commit is contained in:
Dan Stillman 2018-05-23 20:39:32 -04:00
parent 2f620c5f91
commit 3241faf503
3 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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(

View File

@ -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 }]);
});