Skip to content

Commit 83a2e3e

Browse files
authored
Merge pull request #272 from CodIN-INU/develop
refactor: 비로그인시 Comment 조회 수정
2 parents 4145cbc + 135df37 commit 83a2e3e

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/main/java/inu/codin/codin/domain/post/domain/comment/service/CommentQueryService.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,14 @@ private CommentResponseDTO buildCommentResponseDTO(
113113

114114

115115
public UserInfo getUserInfoAboutComment(ObjectId commentId) {
116-
ObjectId userId = SecurityUtils.getCurrentUserId();
117-
return UserInfo.ofComment(
118-
likeService.isLiked(LikeType.COMMENT, commentId.toString(), userId)
119-
);
116+
ObjectId userId = SecurityUtils.getCurrentUserIdOrNull();
117+
118+
boolean isLiked = false;
119+
if (userId != null) {
120+
isLiked = likeService.isLiked(LikeType.COMMENT, commentId.toString(), userId);
121+
}
122+
123+
return UserInfo.ofComment(isLiked);
120124
}
121125
/**
122126
*

0 commit comments

Comments
 (0)