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
commit 08024fcc6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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