Reply button only displays if user has permission to post comments.

This commit is contained in:
Ryan Drew Burnett
2015-11-06 09:01:10 +00:00
parent 778bc8a9dc
commit 6699245cbe

View File

@@ -1,9 +1,11 @@
@using Orchard.Comments.Models @using Orchard.ContentManagement
@using Orchard.ContentManagement @using Orchard.Comments
@using Orchard.Comments.Models
@{ @{
CommentPart comment = Model.ContentPart; CommentPart comment = Model.ContentPart;
CommentsPart comments = comment.CommentedOnContentItem.As<CommentsPart>(); CommentsPart comments = comment.CommentedOnContentItem.As<CommentsPart>();
var isAuthorized = AuthorizedFor(Permissions.AddComment, Model.ContentItem);
var children = New.List(Items: Model.Items); var children = New.List(Items: Model.Items);
children.Classes.Add("comments"); children.Classes.Add("comments");
@@ -22,7 +24,7 @@
<h4> <h4>
<span class="who">@Display.CommentAuthor(ContentPart: comment)</span> <span class="who">@Display.CommentAuthor(ContentPart: comment)</span>
<span class="when">@Display.CommentMetadata(ContentPart: comment)</span> <span class="when">@Display.CommentMetadata(ContentPart: comment)</span>
@if (comments.ThreadedComments && comments.CommentsActive) { @if (comments.ThreadedComments && comments.CommentsActive && isAuthorized) {
@Display.CommentReplyButton(ContentPart: comment) @Display.CommentReplyButton(ContentPart: comment)
} }
</h4> </h4>