bugfix : if current user not logged in,get comments return 500 Internal Server Error

This commit is contained in:
VilenEera 2017-11-02 15:27:49 +08:00
parent ff0d6ebeec
commit 70e12fd3ae

View File

@ -36,7 +36,7 @@ public class CommentQueryService {
public List<CommentData> findByArticleId(String articleId, User user) {
List<CommentData> comments = commentReadService.findByArticleId(articleId);
if (comments.size() > 0) {
if (comments.size() > 0 && user != null) {
Set<String> followingAuthors = userRelationshipQueryService.followingAuthors(user.getId(), comments.stream().map(commentData -> commentData.getProfileData().getId()).collect(Collectors.toList()));
comments.forEach(commentData -> {
if (followingAuthors.contains(commentData.getProfileData().getId())) {