mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-24 01:49:12 +08:00

committed by
Sébastien Ros

parent
f7ddd1eb94
commit
7a734ec8bc
@@ -13,7 +13,7 @@ namespace Orchard.Comments.Drivers {
|
||||
|
||||
protected override DriverResult Display(CommentsContainerPart part, string displayType, dynamic shapeHelper) {
|
||||
|
||||
var commentsForCommentedContent = _commentService.GetCommentsForCommentedContent(part.ContentItem.Id);
|
||||
var commentsForCommentedContent = _commentService.GetCommentsForContainer(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();
|
||||
|
||||
|
@@ -60,6 +60,11 @@ namespace Orchard.Comments.Services {
|
||||
public Localizer T { get; set; }
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public IContentQuery<CommentPart, CommentPartRecord> GetCommentsForContainer(int id) {
|
||||
return GetComments()
|
||||
.Where(c => c.CommentedOnContainer == id);
|
||||
}
|
||||
|
||||
public CommentPart GetComment(int id) {
|
||||
return _orchardServices.ContentManager.Get<CommentPart>(id);
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ namespace Orchard.Comments.Services {
|
||||
IContentQuery<CommentPart, CommentPartRecord> GetComments(CommentStatus status);
|
||||
IContentQuery<CommentPart, CommentPartRecord> GetCommentsForCommentedContent(int id);
|
||||
IContentQuery<CommentPart, CommentPartRecord> GetCommentsForCommentedContent(int id, CommentStatus status);
|
||||
IContentQuery<CommentPart, CommentPartRecord> GetCommentsForContainer(int id);
|
||||
CommentPart GetComment(int id);
|
||||
ContentItemMetadata GetDisplayForCommentedContent(int id);
|
||||
ContentItem GetCommentedContent(int id);
|
||||
|
Reference in New Issue
Block a user