From e64664e926c2cc04d413a91c5fbb4bb58056fee4 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 4 Aug 2020 12:01:53 +0300 Subject: [PATCH] cmskit comment: hide new comment form when not authenticated --- .../Components/Commenting/Default.cshtml | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml index dc3df1d270..e24e99fbaa 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml @@ -16,18 +16,18 @@ ; } @{ - Func GetCommentArea(string repliedCommentIdAsString, bool cancelButton = false) => - @
+ Func GetCommentArea(Guid? repliedCommentId, bool cancelButton = false) => + @
- +
- +
@if (cancelButton) { - @L["Cancel"] + @L["Cancel"] } @L["Send"]
@@ -90,29 +90,35 @@ @GetCommentContentArea(comment.Id, comment.Author.Id, false, comment.Text).Invoke(null) - @GetCommentArea(comment.Id.ToString(), true).Invoke(null) + @if (CurrentUser.IsAuthenticated) + { + @GetCommentArea(comment.Id, true).Invoke(null) + } @if (comment.Replies.Any()) {
- @foreach (var reply in comment.Replies) - { -
-
- - @GetCommentAuthorName(reply.Author).Invoke(null) -
+ @foreach (var reply in comment.Replies) + { +
+
+ + @GetCommentAuthorName(reply.Author).Invoke(null) +
- @GetCommentContentArea(reply.Id, reply.Author.Id, true, reply.Text).Invoke(null) + @GetCommentContentArea(reply.Id, reply.Author.Id, true, reply.Text).Invoke(null) -
- } +
+ }
}
}
- @GetCommentArea("").Invoke(null) + @if (CurrentUser.IsAuthenticated) + { + @GetCommentArea(null).Invoke(null) + }