Get it before filtering the post tag.

pull/859/head
maliming 7 years ago
parent 6ee3a94b31
commit 23a86a10ec

@ -36,19 +36,19 @@ namespace Volo.Blogging.Posts
var userDictionary = new Dictionary<Guid, BlogUserDto>();
var postDtos = new List<PostWithDetailsDto>(ObjectMapper.Map<List<Post>, List<PostWithDetailsDto>>(posts));
if (tag != null)
foreach (var postDto in postDtos)
{
postDtos = await FilterPostsByTag(postDtos, tag);
postDto.Tags = await GetTagsOfPost(postDto.Id);
}
foreach (var postDto in postDtos)
if (tag != null)
{
postDto.CommentCount = await _commentRepository.GetCommentCountOfPostAsync(postDto.Id);
postDtos = await FilterPostsByTag(postDtos, tag);
}
foreach (var postDto in postDtos)
{
postDto.Tags = await GetTagsOfPost(postDto.Id);
postDto.CommentCount = await _commentRepository.GetCommentCountOfPostAsync(postDto.Id);
}
foreach (var postDto in postDtos)

Loading…
Cancel
Save