From 8c5b7b811d998128d3e2da4d6b9ade7542ffea79 Mon Sep 17 00:00:00 2001
From: Klaus <klaus@vividnext.co.kr>
Date: Thu, 21 Dec 2023 23:53:33 +0900
Subject: [PATCH] =?UTF-8?q?=EC=BB=A4=EB=AE=A4=EB=8B=88=ED=8B=B0=20?=
 =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EB=AC=BC=20=EC=A1=B0=ED=9A=8C=20-=20?=
 =?UTF-8?q?=EB=8C=93=EA=B8=80=20=EC=B6=94=EA=B0=80=20=EB=B6=88=EA=B0=80?=
 =?UTF-8?q?=EB=8A=A5=ED=95=9C=20=EA=B2=BD=EC=9A=B0=20=EB=8C=93=EA=B8=80?=
 =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EB=A5=BC=20=ED=95=98=EC=A7=80=20=EC=95=8A?=
 =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../CreatorCommunityService.kt                | 60 +++++++++++--------
 1 file changed, 36 insertions(+), 24 deletions(-)

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