mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 18:11:40 -05:00
19 lines
431 B
JavaScript
19 lines
431 B
JavaScript
![]() |
Meteor.methods({
|
||
|
comment: function(post, parentComment, text){
|
||
|
var user = Meteor.users.findOne(this.userId());
|
||
|
|
||
|
var comment = {
|
||
|
post: post._id
|
||
|
, body: text
|
||
|
, submitter: user.username
|
||
|
, submitted: new Date().getTime()
|
||
|
};
|
||
|
if(parentComment)
|
||
|
comment.parent = parentComment._id;
|
||
|
|
||
|
Comments.insert(comment);
|
||
|
Posts.update(post._id, {$inc: {comments: 1}});
|
||
|
return true;
|
||
|
}
|
||
|
});
|