Don't try to add child items to collections dragging cross-library

Previously, if you dragged a standalone attachment to a collection in another
library where the item already existed as a child item, it would crash Zotero
on a collection-item constraint.
This commit is contained in:
Dan Stillman 2015-02-24 15:54:34 -05:00
parent 0ab38f1d43
commit 395d596105

View File

@ -1758,8 +1758,12 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient, dataTransfer)
// Add items to target collection
if (targetCollectionID) {
var collection = Zotero.Collections.get(targetCollectionID);
collection.addItems(newIDs);
let ids = newIDs.filter(function (itemID) {
var item = Zotero.Items.get(itemID);
return !item.getSource();
});
let collection = Zotero.Collections.get(targetCollectionID);
collection.addItems(ids);
}
// If moving, remove items from source collection