www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit afc7afeb9cc98a435251df62a371fdc979c391b4
parent 49506b6d94318652704fa7a4234e698b6cae792e
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon, 18 Sep 2017 17:03:12 -0400

Fix error deleting collection after emptying trash

Follow-up to c442daedce
Fixes #1317

Diffstat:
Mchrome/content/zotero/xpcom/data/collection.js | 2+-
Mtest/tests/collectionTest.js | 8+++++++-
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/collection.js b/chrome/content/zotero/xpcom/data/collection.js @@ -427,7 +427,7 @@ Zotero.Collection.prototype.removeItems = Zotero.Promise.coroutine(function* (it return; } - var current = this.getChildItems(true); + var current = this.getChildItems(true, true); Zotero.DB.requireTransaction(); for (let i=0; i<itemIDs.length; i++) { diff --git a/test/tests/collectionTest.js b/test/tests/collectionTest.js @@ -251,7 +251,13 @@ describe("Zotero.Collection", function() { var item = yield createDataObject('item', { collections: [ col.id ] }); assert.lengthOf(col.getChildItems(), 1); yield item.erase(); - Zotero.debug(col.getChildItems()); + assert.lengthOf(col.getChildItems(), 0); + }); + + it("should not include items emptied from trash", function* () { + var col = yield createDataObject('collection'); + var item = yield createDataObject('item', { collections: [ col.id ], deleted: true }); + yield item.erase(); assert.lengthOf(col.getChildItems(), 0); }); })