From 6cd3e1f472562a508dcf985d3dd25fe7b37aa493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 15 Aug 2020 15:35:13 +0300 Subject: [PATCH] Add TODO and change List to IReadOnlyList for CommentingViewComponent --- .../Components/Commenting/CommentingViewComponent.cs | 12 ++++++++---- .../Shared/Components/Commenting/Default.cshtml | 1 - 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs index 25a763e3d2..eaa25b21cb 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs @@ -24,16 +24,20 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting CommentPublicAppService = commentPublicAppService; } - public virtual async Task InvokeAsync(string entityType, string entityId, string loginUrl = null) + public virtual async Task InvokeAsync( + string entityType, + string entityId, + string loginUrl = null) //TODO: This can be a configuration (default: /Account/Login) rather than passing it to the component { - var result = await CommentPublicAppService.GetListAsync(entityType, entityId); + var result = await CommentPublicAppService + .GetListAsync(entityType, entityId); var viewModel = new CommentingViewModel { EntityId = entityId, EntityType = entityType, LoginUrl = loginUrl, - Comments = result.Items.ToList() + Comments = result.Items }; return View("~/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml", viewModel); @@ -47,7 +51,7 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting public string LoginUrl { get; set; } - public List Comments { get; set; } + public IReadOnlyList Comments { get; set; } } } } 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 743f4f7d9c..26faec1ffa 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 @@ -1,7 +1,6 @@ @using Microsoft.AspNetCore.Html @using Microsoft.AspNetCore.Mvc.Localization @using Volo.Abp.Users -@using Volo.CmsKit.Comments @using Volo.CmsKit.Localization @using Volo.CmsKit.Public.Comments @inject ICurrentUser CurrentUser