diff --git a/chrome/content/zotero/xpcom/data/dataObjectUtilities.js b/chrome/content/zotero/xpcom/data/dataObjectUtilities.js index 1f3ca4717d..72ad50c124 100644 --- a/chrome/content/zotero/xpcom/data/dataObjectUtilities.js +++ b/chrome/content/zotero/xpcom/data/dataObjectUtilities.js @@ -380,6 +380,11 @@ Zotero.DataObjectUtilities = { continue; } + // Ignore noteSchemaVersion: 0 if no local note + if (field == 'noteSchemaVersion' && val === 0) { + continue; + } + changeset.push({ field: field, op: "add", diff --git a/test/tests/syncLocalTest.js b/test/tests/syncLocalTest.js index 674cb526c6..4b5cac3cd0 100644 --- a/test/tests/syncLocalTest.js +++ b/test/tests/syncLocalTest.js @@ -2560,6 +2560,29 @@ describe("Zotero.Sync.Data.Local", function() { assert.lengthOf(result.conflicts, 1); }); + it("should ignore noteSchemaVersion=0 if no note", function () { + var json1 = { + key: "AAAAAAAA", + version: 1234, + title: "Link", + dateModified: "2017-04-02 12:34:56" + }; + var json2 = { + key: "AAAAAAAA", + version: 1235, + title: "Link", + note: "", + noteSchemaVersion: 0, + dateModified: "2017-04-02 12:34:56" + }; + var ignoreFields = ['dateAdded', 'dateModified']; + var result = Zotero.Sync.Data.Local._reconcileChangesWithoutCache( + 'item', json1, json2, ignoreFields + ); + assert.lengthOf(result.changes, 0); + assert.lengthOf(result.conflicts, 0); + }); + it("should automatically use remote version for conflicting fields when both sides are in trash", function () { var json1 = { key: "AAAAAAAA",