Ignore remote noteSchemaVersion: 0 for items with no local note
E.g., embedded attachment notes with no note don't have an itemNotes row and don't output noteSchemaVersion in their JSON, but they shouldn't trigger a conflict
This commit is contained in:
parent
b2aee30410
commit
a0fb7a8583
2 changed files with 28 additions and 0 deletions
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue