mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#18591: Remove pending comments from comments count
Work Item: 18591 --HG-- branch : 1.x
This commit is contained in:
@@ -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))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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))
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user