fix comment publication bug

This commit is contained in:
Sacha Greif 2014-09-19 20:00:22 +09:00
parent 7e34caf0eb
commit d78cb03b89
4 changed files with 8 additions and 3 deletions

1
.meteor/cordova-plugins Normal file
View file

@ -0,0 +1 @@

View file

@ -66,4 +66,3 @@ matb33:collection-hooks
djedi:sanitize-html
rajit:bootstrap3-datepicker
telescope-update-prompt

View file

@ -81,6 +81,7 @@ scheduleNextCampaign = function (isTest) {
Meteor.methods({
testCampaign: function () {
scheduleNextCampaign(true);
if(isAdminById(this.userId))
scheduleNextCampaign(true);
}
});

View file

@ -2,7 +2,11 @@
Meteor.publish('singleComment', function(commentId) {
if(canViewById(this.userId)){
return Comments.find(commentId);
// publish both current comment and child comments
var commentIds = [commentId];
var childCommentIds = _.pluck(Comments.find({parentCommentId: commentId}, {fields: {_id: 1}}).fetch(), '_id');
commentIds = commentIds.concat(childCommentIds);
return Comments.find({_id: {$in: commentIds}});
}
return [];
});