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 d2746284ba..cc37c15c89 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 @@ -169,7 +169,8 @@ } } - @if (CurrentUser.UserName == Model.Post.Writer?.UserName) + + @if (CurrentUser.Id.HasValue && CurrentUser.Id.Value == Model.Post.Writer?.Id) { @L["EditProfile"] } @@ -197,10 +198,11 @@ User Avatar +
- - @(post.Writer?.UserName) + + @(post.Writer!.UserName)
diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs index b200266f0c..114bdbb641 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs @@ -87,13 +87,9 @@ namespace Volo.Blogging.Pages.Blog.Posts Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Post = await _postAppService.GetForReadingAsync(new GetPostInput { BlogId = Blog.Id, Url = PostUrl }); - if (Post.Writer != null) - { - PostsList = await _postAppService.GetListByUserIdAsync(Post.Writer.Id); - }else - { - PostsList = new List(); - } + PostsList = Post.Writer != null + ? await _postAppService.GetListByUserIdAsync(Post.Writer.Id) + : new List(); LatestPosts = await _postAppService.GetLatestBlogPostsAsync(Blog.Id, 5); CommentsWithReplies = await _commentAppService.GetHierarchicalListOfPostAsync(Post.Id);