Browse Source

Refactor #16746

pull/16747/head
Engincan VESKE 3 years ago
parent
commit
cd74de69c4
  1. 8
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml
  2. 10
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs

8
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml

@ -169,7 +169,8 @@
}
</div>
}
@if (CurrentUser.UserName == Model.Post.Writer?.UserName)
@if (CurrentUser.Id.HasValue && CurrentUser.Id.Value == Model.Post.Writer?.Id)
{
<a class="fw-lighter" href="/Members/@Model.Post.Writer?.UserName#edit-profile">@L["EditProfile"] <i class="fas fa-edit"></i></a>
}
@ -197,10 +198,11 @@
<img gravatar-email="@post.Writer.Email" default-image="Identicon" class="last-post-image" alt="User Avatar"/>
</a>
</div>
<div class="col">
<h5 class="last-post-name">
<a href="/Members/@post.Writer?.UserName">
@(post.Writer?.UserName)
<a href="/Members/@post.Writer!.UserName">
@(post.Writer!.UserName)
</a>
</h5>
</div>

10
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<PostWithDetailsDto>();
}
PostsList = Post.Writer != null
? await _postAppService.GetListByUserIdAsync(Post.Writer.Id)
: new List<PostWithDetailsDto>();
LatestPosts = await _postAppService.GetLatestBlogPostsAsync(Blog.Id, 5);
CommentsWithReplies = await _commentAppService.GetHierarchicalListOfPostAsync(Post.Id);

Loading…
Cancel
Save