Vulcan/packages/telescope-posts/lib/callbacks.js

13 lines
401 B
JavaScript
Raw Normal View History

/**
* Increment the user's post count and upvote the post
*/
function afterPostSubmitOperations (post) {
var userId = post.userId,
postAuthor = Meteor.users.findOne(userId);
Meteor.users.update({_id: userId}, {$inc: {"telescope.postCount": 1}});
Telescope.upvoteItem(Posts, post, postAuthor);
return post;
}
2015-04-24 09:48:36 +09:00
Telescope.callbacks.register("postSubmitAsync", afterPostSubmitOperations);