Made sure restoration can find dead children
This commit is contained in:
@@ -64,10 +64,12 @@ makeChild = function(collection, inheritedKeys){
|
|||||||
inheritParentProperties(doc, collection);
|
inheritParentProperties(doc, collection);
|
||||||
});
|
});
|
||||||
|
|
||||||
//when we change parents, inherit its properties
|
|
||||||
collection.after.update(function (userId, doc, fieldNames, modifier, options) {
|
collection.after.update(function (userId, doc, fieldNames, modifier, options) {
|
||||||
if(modifier && modifier.$set && modifier.$set.parent){
|
if(modifier && modifier.$set){
|
||||||
inheritParentProperties(doc, collection);
|
//when we change parents, inherit its properties
|
||||||
|
if(modifier.$set.parent){
|
||||||
|
inheritParentProperties(doc, collection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -119,7 +121,7 @@ Meteor.methods({
|
|||||||
thisModifier = _.clone(modifier);
|
thisModifier = _.clone(modifier);
|
||||||
}
|
}
|
||||||
if(_.isEmpty(thisModifier)) return;
|
if(_.isEmpty(thisModifier)) return;
|
||||||
collection.update( {'parent.id': parent._id}, thisModifier, {multi: true});
|
collection.update( {'parent.id': parent._id}, thisModifier, {multi: true, removed: true});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
removeChildren: function (parent) {
|
removeChildren: function (parent) {
|
||||||
|
|||||||
Reference in New Issue
Block a user