Made sure restoration can find dead children

This commit is contained in:
Thaum
2015-03-25 13:50:21 +00:00
parent 6515f397fe
commit fef2a1083a

View File

@@ -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) {