From efa42349b31b99c3c38136ea2f0c3d2e1cfb78bd Mon Sep 17 00:00:00 2001 From: wakuflair Date: Tue, 30 Jun 2020 19:57:34 +0800 Subject: [PATCH] Omit dropdown menus if not login --- .../CommentEditorWidget/Default.cshtml | 2 +- .../CommentViewerWidgetController.cs | 4 +- .../CommentViewerWidgetViewComponent.cs | 4 +- .../Components/CommentsWidget/Default.cshtml | 37 ++++++++++--------- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentEditorWidget/Default.cshtml b/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentEditorWidget/Default.cshtml index 30c78e1..d0c30a1 100644 --- a/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentEditorWidget/Default.cshtml +++ b/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentEditorWidget/Default.cshtml @@ -3,7 +3,7 @@ @model EasyAbp.EasyComment.Web.Pages.Shared.Components.CommentEditorWidget.CommentEditorViewModel @inject IHtmlLocalizer L -
+ @if (Model.ShowLabel) { diff --git a/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentViewerWidget/CommentViewerWidgetController.cs b/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentViewerWidget/CommentViewerWidgetController.cs index 6622ca6..45af749 100644 --- a/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentViewerWidget/CommentViewerWidgetController.cs +++ b/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentViewerWidget/CommentViewerWidgetController.cs @@ -8,9 +8,9 @@ public class CommentViewerWidgetController : EasyCommentController { [HttpGet] [Route("showCommentViewer")] - public IActionResult ShowCommentViewer(Guid id, string content, bool refreshData) + public IActionResult ShowCommentViewer(Guid id, string content, bool fromServer) { - return ViewComponent("CommentViewerWidget", new {id, content, refreshData}); + return ViewComponent("CommentViewerWidget", new {id, content, fromServer}); } } } \ No newline at end of file diff --git a/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentViewerWidget/CommentViewerWidgetViewComponent.cs b/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentViewerWidget/CommentViewerWidgetViewComponent.cs index 9f46378..b5fa948 100644 --- a/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentViewerWidget/CommentViewerWidgetViewComponent.cs +++ b/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentViewerWidget/CommentViewerWidgetViewComponent.cs @@ -19,9 +19,9 @@ public CommentViewerWidgetViewComponent(ICommentAppService service) _service = service; } - public async Task InvokeAsync(Guid id, string content, bool refreshData) + public async Task InvokeAsync(Guid id, string content, bool fromServer) { - if (refreshData) + if (fromServer) { var comment = await _service.GetAsync(id); content = comment.Content; diff --git a/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentsWidget/Default.cshtml b/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentsWidget/Default.cshtml index b6f62d3..48833f1 100644 --- a/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentsWidget/Default.cshtml +++ b/src/EasyAbp.EasyComment.Web/Pages/Shared/Components/CommentsWidget/Default.cshtml @@ -27,26 +27,29 @@ - - - - @if (comment.CreatorId == CurrentUser.GetId()) - { - @L["Edit"] - } - @L["Reply"] - @L["Reference"] - @if (comment.CreatorId == CurrentUser.GetId()) - { - - @L["Remove"] - } - - + @if (CurrentUser.IsAuthenticated) + { + + + + @if (comment.CreatorId == CurrentUser.GetId()) + { + @L["Edit"] + } + @L["Reply"] + @L["Reference"] + @if (comment.CreatorId == CurrentUser.GetId()) + { + + @L["Remove"] + } + + + }
- @await Component.InvokeAsync("CommentViewerWidget", new {Id = comment.Id, Content = comment.Content,}) + @await Component.InvokeAsync("CommentViewerWidget", new {Id = comment.Id, Content = comment.Content, FromServer = false})