Skip to content

Commit

Permalink
Fix sync error after resetting read-only group
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dstillman committed Dec 2, 2017
1 parent 6408469 commit cdaf73b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion chrome/content/zotero/xpcom/sync/syncLocal.js
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/tests/syncLocalTest.js
Expand Up @@ -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"));
Expand Down

0 comments on commit cdaf73b

Please sign in to comment.