mirror of
https://github.com/vale981/Vulcan
synced 2025-03-12 13:36:37 -04:00
20 lines
506 B
JavaScript
20 lines
506 B
JavaScript
/*
|
|
|
|
Voting callbacks
|
|
|
|
*/
|
|
|
|
import Posts from '../../../modules/posts/index.js';
|
|
import Users from 'meteor/vulcan:users';
|
|
import { addCallback } from 'meteor/vulcan:core';
|
|
import { operateOnItem } from 'meteor/vulcan:voting';
|
|
|
|
/**
|
|
* @summary Make users upvote their own new posts
|
|
*/
|
|
function PostsNewUpvoteOwnPost(post) {
|
|
var postAuthor = Users.findOne(post.userId);
|
|
return {...post, ...operateOnItem(Posts, post, postAuthor, 'upvote', false)};
|
|
}
|
|
|
|
addCallback('posts.new.sync', PostsNewUpvoteOwnPost);
|