Fix error deleting collection after emptying trash
Follow-up to c442daedce
Fixes #1317
This commit is contained in:
parent
49506b6d94
commit
afc7afeb9c
|
@ -427,7 +427,7 @@ Zotero.Collection.prototype.removeItems = Zotero.Promise.coroutine(function* (it
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var current = this.getChildItems(true);
|
var current = this.getChildItems(true, true);
|
||||||
|
|
||||||
Zotero.DB.requireTransaction();
|
Zotero.DB.requireTransaction();
|
||||||
for (let i=0; i<itemIDs.length; i++) {
|
for (let i=0; i<itemIDs.length; i++) {
|
||||||
|
|
|
@ -251,7 +251,13 @@ describe("Zotero.Collection", function() {
|
||||||
var item = yield createDataObject('item', { collections: [ col.id ] });
|
var item = yield createDataObject('item', { collections: [ col.id ] });
|
||||||
assert.lengthOf(col.getChildItems(), 1);
|
assert.lengthOf(col.getChildItems(), 1);
|
||||||
yield item.erase();
|
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);
|
assert.lengthOf(col.getChildItems(), 0);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user