diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt index 9d7aed0..37e0dae 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt @@ -149,15 +149,19 @@ class CreatorCommunityService( } else { 0 } - val commentList = commentRepository.findByPostId( - cloudFrontHost = imageHost, - timezone = timezone, - id = it.id!!, - offset = 0, - limit = 1 - ) + val commentList = if (it.isCommentAvailable) { + commentRepository.findByPostId( + cloudFrontHost = imageHost, + timezone = timezone, + id = it.id!!, + offset = 0, + limit = 1 + ) + } else { + listOf() + } - val firstComment = if (commentList.isNotEmpty()) { + val firstComment = if (it.isCommentAvailable && commentList.isNotEmpty()) { commentList[0] } else { null @@ -206,15 +210,19 @@ class CreatorCommunityService( } else { 0 } - val commentList = commentRepository.findByPostId( - cloudFrontHost = imageHost, - timezone = timezone, - id = post.id!!, - offset = 0, - limit = 1 - ) + val commentList = if (post.isCommentAvailable) { + commentRepository.findByPostId( + cloudFrontHost = imageHost, + timezone = timezone, + id = post.id!!, + offset = 0, + limit = 1 + ) + } else { + listOf() + } - val firstComment = if (commentList.isNotEmpty()) { + val firstComment = if (post.isCommentAvailable && commentList.isNotEmpty()) { commentList[0] } else { null @@ -374,15 +382,19 @@ class CreatorCommunityService( } else { 0 } - val commentList = commentRepository.findByPostId( - cloudFrontHost = imageHost, - timezone = timezone, - id = it.id!!, - offset = 0, - limit = 1 - ) + val commentList = if (it.isCommentAvailable) { + commentRepository.findByPostId( + cloudFrontHost = imageHost, + timezone = timezone, + id = it.id!!, + offset = 0, + limit = 1 + ) + } else { + listOf() + } - val firstComment = if (commentList.isNotEmpty()) { + val firstComment = if (it.isCommentAvailable && commentList.isNotEmpty()) { commentList[0] } else { null