Fixed error where searching for properties to insert while having other properties selected could prevent any insert from happening at all

This commit is contained in:
Stefan Zermatten
2021-08-27 12:24:01 +02:00
parent f043c41e12
commit 518880fa5c
5 changed files with 50 additions and 3 deletions

View File

@@ -93,7 +93,15 @@ function insertPropertyFromNode(nodeId, ancestors, order){
_id: nodeId,
removed: {$ne: true},
});
if (!node) throw `Node not found for nodeId: ${nodeId}`;
if (!node) {
if (Meteor.isClient) return;
else {
throw new Meteor.Error(
'Insert property from library failed',
`No library document with id '${nodeId}' was found`
);
}
}
let oldParent = node.parent;
let nodes = LibraryNodes.find({
'ancestors.id': nodeId,