Fix inability to drag subcollection to top level within group library

HTML tree regression

Fixes #2201
This commit is contained in:
Dan Stillman 2021-09-14 00:15:07 -04:00
parent c5067edd2d
commit aeabe0b3f6

View file

@ -1372,13 +1372,14 @@ var CollectionTree = class CollectionTree extends LibraryTree {
return true;
}
else if (dataType == 'zotero/collection') {
if (!treeRow.isLibrary() && !treeRow.isCollection()) {
if (!treeRow.isLibrary(true) && !treeRow.isCollection()) {
return false;
}
let draggedCollectionID = data[0];
let draggedCollection = Zotero.Collections.get(draggedCollectionID);
// Dragging within same library
if (treeRow.ref.libraryID == draggedCollection.libraryID) {
// Collections cannot be dropped on themselves
if (draggedCollectionID == treeRow.ref.id) {
@ -1390,13 +1391,6 @@ var CollectionTree = class CollectionTree extends LibraryTree {
return false;
}
}
// Dragging a collection to a different library
else {
// Allow cross-library drag only to root library and collections
if (!treeRow.isLibrary(true) && !treeRow.isCollection()) {
return false;
}
}
return true;
}