From cdaf73b3d07cc40ccb3207e99b10541c29916680 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 2 Dec 2017 01:35:23 -0500 Subject: [PATCH] Fix sync error after resetting read-only group If an item needed to be erased, it would fail with "Cannot edit item in read-only library", because the deletion didn't skip the edit check. --- chrome/content/zotero/xpcom/sync/syncLocal.js | 8 +++++++- test/tests/syncLocalTest.js | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/sync/syncLocal.js b/chrome/content/zotero/xpcom/sync/syncLocal.js index f529f379a6..fbc8cfd57c 100644 --- a/chrome/content/zotero/xpcom/sync/syncLocal.js +++ b/chrome/content/zotero/xpcom/sync/syncLocal.js @@ -277,7 +277,13 @@ Zotero.Sync.Data.Local = { } } if (toDelete.length) { - yield objectsClass.erase(toDelete, { skipDeleteLog: true }); + yield objectsClass.erase( + toDelete, + { + skipEditCheck: true, + skipDeleteLog: true + } + ); } // Deleted objects diff --git a/test/tests/syncLocalTest.js b/test/tests/syncLocalTest.js index 52de084476..9b835cb0e0 100644 --- a/test/tests/syncLocalTest.js +++ b/test/tests/syncLocalTest.js @@ -281,6 +281,10 @@ describe("Zotero.Sync.Data.Local", function() { var deletedItemKey = deletedItem.key; yield deletedItem.eraseTx(); + // Make group read-only + group.editable = false; + yield group.saveTx(); + yield Zotero.Sync.Data.Local.resetUnsyncedLibraryData(libraryID); assert.isNull(Zotero.SyncedSettings.get(group.libraryID, "testSetting"));