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> </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> <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"/> <img gravatar-email="@post.Writer.Email" default-image="Identicon" class="last-post-image" alt="User Avatar"/>
</a> </a>
</div> </div>
<div class="col"> <div class="col">
<h5 class="last-post-name"> <h5 class="last-post-name">
<a href="/Members/@post.Writer?.UserName"> <a href="/Members/@post.Writer!.UserName">
@(post.Writer?.UserName) @(post.Writer!.UserName)
</a> </a>
</h5> </h5>
</div> </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); Blog = await _blogAppService.GetByShortNameAsync(BlogShortName);
Post = await _postAppService.GetForReadingAsync(new GetPostInput { BlogId = Blog.Id, Url = PostUrl }); Post = await _postAppService.GetForReadingAsync(new GetPostInput { BlogId = Blog.Id, Url = PostUrl });
if (Post.Writer != null) PostsList = Post.Writer != null
{ ? await _postAppService.GetListByUserIdAsync(Post.Writer.Id)
PostsList = await _postAppService.GetListByUserIdAsync(Post.Writer.Id); : new List<PostWithDetailsDto>();
}else
{
PostsList = new List<PostWithDetailsDto>();
}
LatestPosts = await _postAppService.GetLatestBlogPostsAsync(Blog.Id, 5); LatestPosts = await _postAppService.GetLatestBlogPostsAsync(Blog.Id, 5);
CommentsWithReplies = await _commentAppService.GetHierarchicalListOfPostAsync(Post.Id); CommentsWithReplies = await _commentAppService.GetHierarchicalListOfPostAsync(Post.Id);

Loading…
Cancel
Save