diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogFeaturePublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogFeaturePublicAppService.cs index 4606198932..c467b3acc7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogFeaturePublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogFeaturePublicAppService.cs @@ -6,6 +6,6 @@ namespace Volo.CmsKit.Public.Blogs { public interface IBlogFeaturePublicAppService { - Task GetAsync(Guid blogId, string featureName); + Task GetOrDefaultAsync(Guid blogId, string featureName); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogFeaturePublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogFeaturePublicAppService.cs index 2e8e553a6c..bd95bca2b3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogFeaturePublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogFeaturePublicAppService.cs @@ -22,7 +22,7 @@ namespace Volo.CmsKit.Public.Blogs Cache = cache; } - public async Task GetAsync(Guid blogId, string featureName) + public async Task GetOrDefaultAsync(Guid blogId, string featureName) { return await Cache.GetOrAddAsync( $"{blogId}_{featureName}", diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogFeaturePublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogFeaturePublicController.cs index 6c3579da4b..de957f5bd2 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogFeaturePublicController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogFeaturePublicController.cs @@ -19,9 +19,9 @@ namespace Volo.CmsKit.Public.HttpApi.Volo.CmsKit.Public.Blogs [HttpGet] [Route("{blogId}/{featureName}")] - public Task GetAsync(Guid blogId, string featureName) + public Task GetOrDefaultAsync(Guid blogId, string featureName) { - return BlogFeaturePublicAppService.GetAsync(blogId, featureName); + return BlogFeaturePublicAppService.GetOrDefaultAsync(blogId, featureName); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml.cs index fb7a8de563..db178f2515 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml.cs @@ -46,17 +46,17 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Blogs if (GlobalFeatureManager.Instance.IsEnabled()) { - CommentsFeature = await BlogFeaturePublicAppService.GetAsync(BlogPost.BlogId, BlogPostConsts.CommentsFeatureName); + CommentsFeature = await BlogFeaturePublicAppService.GetOrDefaultAsync(BlogPost.BlogId, BlogPostConsts.CommentsFeatureName); } if (GlobalFeatureManager.Instance.IsEnabled()) { - ReactionsFeature = await BlogFeaturePublicAppService.GetAsync(BlogPost.BlogId, BlogPostConsts.ReactionsFeatureName); + ReactionsFeature = await BlogFeaturePublicAppService.GetOrDefaultAsync(BlogPost.BlogId, BlogPostConsts.ReactionsFeatureName); } if (GlobalFeatureManager.Instance.IsEnabled()) { - RatingsFeature = await BlogFeaturePublicAppService.GetAsync(BlogPost.BlogId, BlogPostConsts.RatingsFeatureName); + RatingsFeature = await BlogFeaturePublicAppService.GetOrDefaultAsync(BlogPost.BlogId, BlogPostConsts.RatingsFeatureName); } } } diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogFeaturePublicAppService_Test.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogFeaturePublicAppService_Test.cs index 3376173986..fc34e8df8f 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogFeaturePublicAppService_Test.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogFeaturePublicAppService_Test.cs @@ -23,7 +23,7 @@ namespace Volo.CmsKit.Blogs [Fact] public async Task GetAsync_ShouldWorkProperly_WithExistingFeatureName() { - var result = await blogFeaturePublicAppService.GetAsync(testData.Blog_Id, testData.BlogFeature_1_FeatureName); + var result = await blogFeaturePublicAppService.GetOrDefaultAsync(testData.Blog_Id, testData.BlogFeature_1_FeatureName); result.ShouldNotBeNull(); result.FeatureName.ShouldBe(testData.BlogFeature_1_FeatureName); @@ -33,7 +33,7 @@ namespace Volo.CmsKit.Blogs public async Task GetAsync_ShouldReturnDefault_WithNonExistingFeatureName() { var nonExistingFeatureName = "AnyOtherFeature"; - var result = await blogFeaturePublicAppService.GetAsync(testData.Blog_Id, nonExistingFeatureName); + var result = await blogFeaturePublicAppService.GetOrDefaultAsync(testData.Blog_Id, nonExistingFeatureName); var defaultFeature = new BlogFeature(Guid.Empty, nonExistingFeatureName); result.ShouldNotBeNull();