diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerController.kt index bf367df..b47792a 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerController.kt @@ -52,7 +52,6 @@ class ExplorerController(private val service: ExplorerService) { fun getCreatorProfile( @PathVariable("id") creatorId: Long, @RequestParam timezone: String, - @RequestParam("languageCode", required = false) languageCode: String? = null, @RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null, @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? ) = run { @@ -61,7 +60,6 @@ class ExplorerController(private val service: ExplorerService) { service.getCreatorProfile( creatorId = creatorId, timezone = timezone, - languageCode = languageCode, isAdultContentVisible = isAdultContentVisible ?: true, member = member ) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt index 083ab78..c438b83 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt @@ -19,6 +19,7 @@ import kr.co.vividnext.sodalive.explorer.profile.PutWriteCheersRequest import kr.co.vividnext.sodalive.explorer.profile.creatorCommunity.CreatorCommunityService import kr.co.vividnext.sodalive.fcm.FcmEvent import kr.co.vividnext.sodalive.fcm.FcmEventType +import kr.co.vividnext.sodalive.i18n.LangContext import kr.co.vividnext.sodalive.live.room.detail.GetRoomDetailUser import kr.co.vividnext.sodalive.member.Member import kr.co.vividnext.sodalive.member.MemberRole @@ -49,6 +50,8 @@ class ExplorerService( private val applicationEventPublisher: ApplicationEventPublisher, private val contentTranslationRepository: ContentTranslationRepository, + private val langContext: LangContext, + @Value("\${cloud.aws.cloud-front.host}") private val cloudFrontHost: String ) { @@ -172,7 +175,6 @@ class ExplorerService( fun getCreatorProfile( creatorId: Long, timezone: String, - languageCode: String?, isAdultContentVisible: Boolean, member: Member ): GetCreatorProfileResponse { @@ -235,24 +237,19 @@ class ExplorerService( listOf() } - val translatedContentList = if (!languageCode.isNullOrBlank() && contentList.isNotEmpty()) { - val contentIds = contentList.map { it.contentId } + val contentIds = contentList.map { it.contentId } + val translatedContentList = if (contentIds.isNotEmpty()) { + val translations = contentTranslationRepository + .findByContentIdInAndLocale(contentIds = contentIds, locale = langContext.lang.code) + .associateBy { it.contentId } - if (contentIds.isNotEmpty()) { - val translations = contentTranslationRepository - .findByContentIdInAndLocale(contentIds = contentIds, locale = languageCode) - .associateBy { it.contentId } - - contentList.map { item -> - val translatedTitle = translations[item.contentId]?.renderedPayload?.title - if (translatedTitle.isNullOrBlank()) { - item - } else { - item.copy(title = translatedTitle) - } + contentList.map { item -> + val translatedTitle = translations[item.contentId]?.renderedPayload?.title + if (translatedTitle.isNullOrBlank()) { + item + } else { + item.copy(title = translatedTitle) } - } else { - contentList } } else { contentList