diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index 939dc29640..1983bd3cbf 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -203,21 +203,22 @@ namespace Volo.Blogging.Posts foreach (var postDto in postDtos) { - if (postDto.CreatorId.HasValue) + if (!postDto.CreatorId.HasValue) { - if (!userDictionary.ContainsKey(postDto.CreatorId.Value)) - { - var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); - if (creatorUser != null) - { - userDictionary[creatorUser.Id] = ObjectMapper.Map(creatorUser); - } - } + continue; + } - if (userDictionary.ContainsKey(postDto.CreatorId.Value)) - { - postDto.Writer = userDictionary[(Guid)postDto.CreatorId]; - } + if (userDictionary.TryGetValue(postDto.CreatorId.Value, out var creatorUserDto)) + { + postDto.Writer = creatorUserDto; + continue; + } + + var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); + if (creatorUser != null) + { + postDto.Writer = ObjectMapper.Map(creatorUser); + userDictionary[creatorUser.Id] = postDto.Writer; } } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml index 43ad9abc2f..9c44b0feb2 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml @@ -129,6 +129,11 @@ +
+

+ @Html.Raw(BloggingPageHelper.RenderMarkdownToHtml(Model.Post.Content)) +

+
@@ -210,19 +215,6 @@
-
-
-
-

- @Html.Raw(BloggingPageHelper.RenderMarkdownToHtml(Model.Post.Content)) -

-
-
-
- -
-
-
@if (Model.Post.Tags.Count > 0)