fix(content): 상세 연관 콘텐츠에 요청 언어의 저장된 제목을 적용한다
This commit is contained in:
@@ -800,6 +800,24 @@ class AudioContentService(
|
||||
isAdult = isAdult
|
||||
)
|
||||
|
||||
val relatedContentIds = listOfNotNull(previousContent, nextContent)
|
||||
.plus(creatorOtherContentList)
|
||||
.plus(sameThemeOtherContentList)
|
||||
.map { it.contentId }
|
||||
.distinct()
|
||||
val relatedTranslations = if (relatedContentIds.isNotEmpty()) {
|
||||
contentTranslationRepository
|
||||
.findByContentIdInAndLocale(contentIds = relatedContentIds, locale = langContext.lang.code)
|
||||
.associateBy { it.contentId }
|
||||
} else {
|
||||
emptyMap()
|
||||
}
|
||||
|
||||
fun translateRelatedContent(item: OtherContentResponse): OtherContentResponse {
|
||||
val translatedTitle = relatedTranslations[item.contentId]?.renderedPayload?.title
|
||||
return if (translatedTitle.isNullOrBlank()) item else item.copy(title = translatedTitle)
|
||||
}
|
||||
|
||||
val likeCount = audioContentLikeRepository.totalCountAudioContentLike(contentId = id)
|
||||
val isLike = audioContentLikeRepository.findByMemberIdAndContentId(
|
||||
memberId = member.id!!,
|
||||
@@ -942,8 +960,8 @@ class AudioContentService(
|
||||
purchaseOption = purchaseOption,
|
||||
orderType = orderType,
|
||||
remainingTime = remainingTime,
|
||||
creatorOtherContentList = creatorOtherContentList,
|
||||
sameThemeOtherContentList = sameThemeOtherContentList,
|
||||
creatorOtherContentList = creatorOtherContentList.map(::translateRelatedContent),
|
||||
sameThemeOtherContentList = sameThemeOtherContentList.map(::translateRelatedContent),
|
||||
isCommentAvailable = audioContent.isCommentAvailable,
|
||||
isLike = isLike,
|
||||
likeCount = likeCount,
|
||||
@@ -963,8 +981,8 @@ class AudioContentService(
|
||||
isFollow = creatorFollowing?.isFollow ?: false,
|
||||
isNotify = creatorFollowing?.isNotify ?: false
|
||||
),
|
||||
previousContent = previousContent,
|
||||
nextContent = nextContent,
|
||||
previousContent = previousContent?.let(::translateRelatedContent),
|
||||
nextContent = nextContent?.let(::translateRelatedContent),
|
||||
buyerList = buyerList,
|
||||
isAvailableUsePoint = audioContent.isPointAvailable && audioContent.price > 0,
|
||||
translated = translation.translated,
|
||||
|
||||
Reference in New Issue
Block a user