Merge pull request #875 from saimeunt/devel

Unify posts hooks
This commit is contained in:
Sacha Greif 2015-04-01 09:44:33 +09:00
commit 9290c51477

View file

@ -364,9 +364,9 @@ submitPost = function (post) {
if (Meteor.isServer) {
Meteor.defer(function () { // use defer to avoid holding up client
// run all post submit server callbacks on post object successively
post = postAfterSubmitMethodCallbacks.reduce(function(result, currentFunction) {
return currentFunction(result);
}, post);
postAfterSubmitMethodCallbacks.forEach(function(currentFunction) {
currentFunction(post);
});
});
}
@ -492,10 +492,14 @@ Meteor.methods({
// ------------------------------ Callbacks ------------------------------ //
// run all post after edit method callbacks successively
postAfterEditMethodCallbacks.forEach(function(currentFunction) {
currentFunction(modifier, postId);
});
if (Meteor.isServer) {
Meteor.defer(function () { // use defer to avoid holding up client
// run all post after edit method callbacks successively
postAfterEditMethodCallbacks.forEach(function(currentFunction) {
currentFunction(modifier, post);
});
});
}
// ------------------------------ After Update ------------------------------ //