Fix logged error when dragging collection to another library
"Collection ID '1234' is not an integer (string)"
This commit is contained in:
parent
37c51242d2
commit
c73e664312
1 changed files with 9 additions and 7 deletions
|
@ -2056,8 +2056,10 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
|
||||||
}
|
}
|
||||||
// Mark copied item for adding to collection
|
// Mark copied item for adding to collection
|
||||||
if (parentID) {
|
if (parentID) {
|
||||||
if (!addItems[parentID]) {
|
let parentItems = addItems.get(parentID);
|
||||||
addItems[parentID] = [];
|
if (!parentItems) {
|
||||||
|
parentItems = [];
|
||||||
|
addItems.set(parentID, parentItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If source item is a top-level non-regular item (which can exist in a
|
// If source item is a top-level non-regular item (which can exist in a
|
||||||
|
@ -2071,7 +2073,7 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addItems[parentID].push(id);
|
parentItems.push(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2083,11 +2085,11 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
|
||||||
type: 'collection'
|
type: 'collection'
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var addItems = {};
|
var addItems = new Map();
|
||||||
yield copyCollections(collections, targetCollectionID, addItems);
|
yield copyCollections(collections, targetCollectionID, addItems);
|
||||||
for (var collectionID in addItems) {
|
for (let [collectionID, items] of addItems.entries()) {
|
||||||
var collection = yield Zotero.Collections.getAsync(collectionID);
|
let collection = yield Zotero.Collections.getAsync(collectionID);
|
||||||
yield collection.addItems(addItems[collectionID]);
|
yield collection.addItems(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add subcollections and subitems, if they don't already exist,
|
// TODO: add subcollections and subitems, if they don't already exist,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue