var getCommentsByPostId = function(postId){ var comments = model.Comment.query().equals('postid',postId).equals('spam',false).orderBy('createTime','desc').select(); for(var i=0;i<comments.length;i++){ comments[i].gravatarHash = getCommentGravatarHash(comments[i].email); } return comments; }
var getPageComments = function(currentPage){ return model.Comment.query().orderBy('createTime','desc').offset(currentPage*CONSTANTS.POSTS_PER_PAGE).limit(CONSTANTS.POSTS_PER_PAGE).select(); }
var isCommentAuthorWhitelisted = function(email){ var commentsApprovedForThisEmail = model.Comment.query().equals('email',email).equals('spam',false).select(); return commentsApprovedForThisEmail.length>0; }
var getCommentById = function(id){ return model.Comment.get(id); }