change callback syntax and add return statement

This commit is contained in:
Sacha Greif 2015-04-23 11:24:59 +09:00
parent f2f8f4b2c3
commit 04061aca9e
2 changed files with 11 additions and 4 deletions

View file

@ -123,7 +123,7 @@ Comments.before.update(function (userId, doc, fieldNames, modifier, options) {
} }
}); });
commentAfterSubmitMethodCallbacks.push(function (comment) { function afterCommentOperations (comment) {
var userId = comment.userId, var userId = comment.userId,
commentAuthor = Meteor.users.findOne(userId); commentAuthor = Meteor.users.findOne(userId);
@ -143,7 +143,11 @@ commentAfterSubmitMethodCallbacks.push(function (comment) {
// upvote comment // upvote comment
Telescope.upvoteItem(Comments, comment, commentAuthor); Telescope.upvoteItem(Comments, comment, commentAuthor);
}); return comment;
};
commentAfterSubmitMethodCallbacks.push(afterCommentOperations);
// ------------------------------------------------------------------------------------------- // // ------------------------------------------------------------------------------------------- //
// -------------------------------------- Submit Comment ------------------------------------- // // -------------------------------------- Submit Comment ------------------------------------- //

View file

@ -26,7 +26,8 @@ Posts.hooks.approvedCallbacks.push(function (post) {
}); });
// add new comment notification callback on comment submit // add new comment notification callback on comment submit
commentAfterSubmitMethodCallbacks.push(function (comment) { function addCommentNotification (comment) {
if(Meteor.isServer && !comment.disableNotifications){ if(Meteor.isServer && !comment.disableNotifications){
var post = Posts.findOne(comment.postId), var post = Posts.findOne(comment.postId),
@ -81,7 +82,9 @@ commentAfterSubmitMethodCallbacks.push(function (comment) {
return comment; return comment;
}); }
commentAfterSubmitMethodCallbacks.push(addCommentNotification);
var emailNotifications = { var emailNotifications = {
propertyName: 'emailNotifications', propertyName: 'emailNotifications',