Fixes #520, deleting items from smart collections/search fails under certain circumstances
Simon, reopen if this doesn't fix the problem you were referring to. (Also removes Notifier.enable()/disable() from its use in Item.erase() while we're at it.)
This commit is contained in:
parent
b3588e6b75
commit
56a0863a9d
|
@ -1868,19 +1868,9 @@ Zotero.Item.prototype.erase = function(deleteChildren){
|
||||||
// Remove item from parent collections
|
// Remove item from parent collections
|
||||||
var parentCollectionIDs = this.getCollections();
|
var parentCollectionIDs = this.getCollections();
|
||||||
if (parentCollectionIDs){
|
if (parentCollectionIDs){
|
||||||
var notifierState = Zotero.Notifier.isEnabled();
|
|
||||||
Zotero.Notifier.disable();
|
|
||||||
|
|
||||||
for (var i=0; i<parentCollectionIDs.length; i++){
|
for (var i=0; i<parentCollectionIDs.length; i++){
|
||||||
Zotero.Collections.get(parentCollectionIDs[i]).removeItem(this.getID());
|
Zotero.Collections.get(parentCollectionIDs[i]).removeItem(this.getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notifierState){
|
|
||||||
Zotero.Notifier.enable();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Zotero.Notifier.disable();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
|
@ -2373,7 +2363,7 @@ Zotero.Items = new function(){
|
||||||
var item = this.get(id);
|
var item = this.get(id);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
Zotero.debug('Item ' + id + ' does not exist in Items.erase()!', 1);
|
Zotero.debug('Item ' + id + ' does not exist in Items.erase()!', 1);
|
||||||
Zotero.Notifier.trigger('item', 'delete', id);
|
Zotero.Notifier.trigger('delete', 'item', id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
item.erase(eraseChildren); // calls unload()
|
item.erase(eraseChildren); // calls unload()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user