diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.CommentForm.cshtml b/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.CommentForm.cshtml index 5e5b8344b..1467da953 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.CommentForm.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.CommentForm.cshtml @@ -7,8 +7,8 @@ CommentsPart commentsPart = Model.ContentPart; bool canStillCommentOn = Model.CanStillComment; var settings = commentsPart.TypePartDefinition.Settings.GetModel(); + var isAuthorized = AuthorizedFor(Permissions.AddComment, Model.ContentItem); } - @if (!Model.ContentPart.CommentsActive || !canStillCommentOn) { if (Model.ContentPart.Comments.Count > 0) {
@@ -16,17 +16,16 @@
} } -else if (settings.MustBeAuthenticated && WorkContext.CurrentUser == null) { -
-

@T("You must be authenticated in order to add a comment.")

-
-} -else if (WorkContext.CurrentUser == null && !AuthorizedFor(Permissions.AddComment)) { -

@T("Add a Comment")

+else if ((settings.MustBeAuthenticated || !isAuthorized) && WorkContext.CurrentUser == null) {

@T("You must {0} to comment.", Html.ActionLink(T("log on").ToString(), "LogOn", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = string.Format("{0}#addacomment", Context.Request.RawUrl) }))

} -else { +else if (WorkContext.CurrentUser != null && !isAuthorized) { +
+

@T("You are not authorized to add a comment.")

+
+} +else if (isAuthorized) { @Html.ValidationSummary() using (Html.BeginFormAntiForgeryPost(Url.Action("Create", "Comment", new { Area = "Orchard.Comments", ReturnUrl = Context.Request.ToUrlString() }), FormMethod.Post, new { @class = "comment-form" })) {