Merge pull request #2 from VilenEera/bugfix

if current user not logged in,get comments return 500 Internal Server Error
This commit is contained in:
aisensiy
2017-11-02 03:02:43 -05:00
committed by GitHub

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())) {