diff --git a/chrome/content/zotero/xpcom/data/collection.js b/chrome/content/zotero/xpcom/data/collection.js index 83579a93b1..ffc0d3d7be 100644 --- a/chrome/content/zotero/xpcom/data/collection.js +++ b/chrome/content/zotero/xpcom/data/collection.js @@ -608,6 +608,11 @@ Zotero.Collection.prototype._eraseData = Zotero.Promise.coroutine(function* (env libraryID: c.libraryID, key: c.key }; + // skipDeleteLog is normally added to notifierData in DataObject::_finalizeErase(), + // so we have to do it manually here + if (env.options && env.options.skipDeleteLog) { + env.notifierData[c.id].skipDeleteLog = true; + } } } // Descendent items diff --git a/test/tests/collectionTest.js b/test/tests/collectionTest.js index 6304d8a41c..a9b19869f1 100644 --- a/test/tests/collectionTest.js +++ b/test/tests/collectionTest.js @@ -61,6 +61,21 @@ describe("Zotero.Collection", function() { yield collection.eraseTx({ deleteItems: true }); assert.lengthOf(item.getCollections(), 0); }); + + it("should apply 'skipDeleteLog: true' to subcollections", async function () { + var collection1 = await createDataObject('collection'); + var collection2 = await createDataObject('collection', { parentID: collection1.id }); + var collection3 = await createDataObject('collection', { parentID: collection2.id }); + + await collection1.eraseTx({ skipDeleteLog: true }); + + var deleted = await Zotero.Sync.Data.Local.getDeleted('collection', collection1.libraryID); + + // No collections should be in the delete log + assert.notInclude(deleted, collection1.key); + assert.notInclude(deleted, collection2.key); + assert.notInclude(deleted, collection3.key); + }); }) describe("#version", function () {