Added user for each comment
This commit is contained in:
parent
0afd5c2ba1
commit
37e0da4322
@ -208,11 +208,12 @@ Meteor.methods({
|
|||||||
'addComment': function(input) {
|
'addComment': function(input) {
|
||||||
var comment = input[0];
|
var comment = input[0];
|
||||||
var workobject = work.findOne({_id: input[1]});
|
var workobject = work.findOne({_id: input[1]});
|
||||||
|
var user = Meteor.userId();
|
||||||
var currentclass = classes.findOne({_id: workobject.class});
|
var currentclass = classes.findOne({_id: workobject.class});
|
||||||
if (typeof comment === "string" && comment.length <= 200 &&
|
if (typeof comment === "string" && comment.length <= 200 &&
|
||||||
currentclass.subscribers.indexOf(Meteor.userId()) != -1 &&
|
currentclass.subscribers.indexOf(Meteor.userId()) != -1 &&
|
||||||
currentclass.blockEdit.indexOf(Meteor.userId()) === -1) {
|
currentclass.blockEdit.indexOf(Meteor.userId()) === -1) {
|
||||||
var comments = workobject.comments.push(comment);
|
var comments = workobject.comments.push({comment:comment,user:user});
|
||||||
work.update({_id: input[1]}, {$set: {comments: comments}});
|
work.update({_id: input[1]}, {$set: {comments: comments}});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user