Don't skip creator lines in Extra in fromJSON

Regression in 3de54455f6
This commit is contained in:
Dan Stillman 2020-01-27 22:00:04 -05:00
parent 39d7f22981
commit 4e11c7927d
3 changed files with 14 additions and 1 deletions

View file

@ -4212,6 +4212,8 @@ Zotero.Item.prototype.fromJSON = function (json, options = {}) {
json.extra !== undefined ? json.extra : '',
this,
Object.keys(json)
// TEMP until we move creator lines to real creators
.concat('creators')
);
// Transfer valid fields from Extra to regular fields

View file

@ -1050,7 +1050,7 @@ Zotero.Utilities.Internal = {
}
let possibleCreatorType = creatorTypes.get(key);
if (possibleCreatorType) {
if (possibleCreatorType && !additionalFields.has('creators')) {
let c = {
creatorType: possibleCreatorType
};

View file

@ -1811,6 +1811,17 @@ describe("Zotero.Item", function () {
assert.equal(item.getField('extra'), `doi: ${doi2}`);
});*/
it("should ignore creator field in Extra", async function () {
var json = {
itemType: "journalArticle",
extra: "Author: Name"
};
var item = new Zotero.Item();
item.fromJSON(json);
assert.lengthOf(item.getCreatorsJSON(), 0);
assert.equal(item.getField('extra'), json.extra);
});
it("should store unknown fields in Extra in non-strict mode", function () {
var json = {
itemType: "journalArticle",