From 5d350688bb29e1c75465f3590284f4276d65e996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Thu, 2 Dec 2010 08:20:03 -0800 Subject: [PATCH] Comments from the site owner or administrator should not need moderation Work Item: 16643 --HG-- branch : dev --- .../Orchard.Comments/Controllers/CommentController.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs b/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs index bf4e5e3ac..61e916363 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs +++ b/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs @@ -50,8 +50,15 @@ namespace Orchard.Comments.Controllers { CommentPart commentPart = _commentService.CreateComment(context, Services.WorkContext.CurrentSite.As().Record.ModerateComments); - if (commentPart.Record.Status == CommentStatus.Pending) - Services.Notifier.Information(T("Your comment will appear after the site administrator approves it.")); + if (commentPart.Record.Status == CommentStatus.Pending) { + // if the user who submitted the comment has the right to moderate, don't make this comment moderated + if (Services.Authorizer.Authorize(Permissions.ManageComments)) { + commentPart.Record.Status = CommentStatus.Approved; + } + else { + Services.Notifier.Information(T("Your comment will appear after the site administrator approves it.")); + } + } } else { foreach (var error in ModelState.Values.SelectMany(m => m.Errors).Select( e=> e.ErrorMessage)) {