commit 395d596105a55823bf584c08839833f100d5507e
parent 0ab38f1d43f0809962f7455eb40cfa41786aa4e0
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 24 Feb 2015 15:54:34 -0500
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.
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js
@@ -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