2015-04-23 15:42:05 +09:00
|
|
|
/**
|
|
|
|
* Increment the user's post count and upvote the post
|
|
|
|
*/
|
|
|
|
function afterPostSubmitOperations (post) {
|
2015-06-21 11:58:46 +09:00
|
|
|
var userId = post.userId;
|
2015-05-06 12:16:50 +09:00
|
|
|
Meteor.users.update({_id: userId}, {$inc: {"telescope.postCount": 1}});
|
2015-04-23 15:42:05 +09:00
|
|
|
return post;
|
|
|
|
}
|
2015-05-17 15:38:02 +09:00
|
|
|
Telescope.callbacks.add("postSubmitAsync", afterPostSubmitOperations);
|
2015-06-21 11:58:46 +09:00
|
|
|
|
|
|
|
function upvoteOwnPost (post) {
|
|
|
|
var postAuthor = Meteor.users.findOne(post.userId);
|
|
|
|
Telescope.upvoteItem(Posts, post, postAuthor);
|
|
|
|
return post;
|
|
|
|
}
|
|
|
|
Telescope.callbacks.add("postSubmitAsync", upvoteOwnPost);
|