#18591: Remove pending comments from comments count

Work Item: 18591

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros 2012-04-24 15:05:43 -07:00
parent aa9262b35b
commit 893f88a9c0
2 changed files with 6 additions and 4 deletions

View File

@ -17,13 +17,14 @@ namespace Orchard.Comments.Drivers {
var commentsForCommentedContent = _commentService.GetCommentsForCommentedContent(part.ContentItem.Id);
Func<int> pendingCount = () => commentsForCommentedContent.Where(x => x.Status == CommentStatus.Pending).Count();
Func<int> approvedCount = () => commentsForCommentedContent.Where(x => x.Status == CommentStatus.Approved).Count();
return Combined(
ContentShape("Parts_Comments_Count",
() => shapeHelper.Parts_Comments_Count(CommentCount: commentsForCommentedContent.Count(), PendingCount: pendingCount)),
() => shapeHelper.Parts_Comments_Count(CommentCount: approvedCount, PendingCount: pendingCount)),
ContentShape("Parts_Comments_Count_SummaryAdmin",
() => shapeHelper.Parts_Comments_Count_SummaryAdmin(CommentCount: commentsForCommentedContent.Count(), PendingCount: pendingCount))
() => shapeHelper.Parts_Comments_Count_SummaryAdmin(CommentCount: approvedCount, PendingCount: pendingCount))
);
}
}

View File

@ -20,14 +20,15 @@ namespace Orchard.Comments.Drivers {
var commentsForCommentedContent = _commentService.GetCommentsForCommentedContent(part.ContentItem.Id);
Func<int> pendingCount = () => commentsForCommentedContent.Where(x => x.Status == CommentStatus.Pending).Count();
Func<int> approvedCount = () => commentsForCommentedContent.Where(x => x.Status == CommentStatus.Approved).Count();
return Combined(
ContentShape("Parts_Comments",
() => shapeHelper.Parts_Comments()),
ContentShape("Parts_Comments_Count",
() => shapeHelper.Parts_Comments_Count(CommentCount: commentsForCommentedContent.Count(), PendingCount: pendingCount)),
() => shapeHelper.Parts_Comments_Count(CommentCount: approvedCount, PendingCount: pendingCount)),
ContentShape("Parts_Comments_Count_SummaryAdmin",
() => shapeHelper.Parts_Comments_Count_SummaryAdmin(CommentCount: commentsForCommentedContent.Count(), PendingCount: pendingCount))
() => shapeHelper.Parts_Comments_Count_SummaryAdmin(CommentCount: approvedCount, PendingCount: pendingCount))
);
}