feat(live-room): 라이브 생성 태그 기반 19금 전환 조건 확장
This commit is contained in:
@@ -55,6 +55,7 @@ import kr.co.vividnext.sodalive.live.room.menu.UpdateLiveMenuRequest
|
||||
import kr.co.vividnext.sodalive.live.room.visit.LiveRoomVisitService
|
||||
import kr.co.vividnext.sodalive.live.roulette.NewRouletteRepository
|
||||
import kr.co.vividnext.sodalive.live.signature.SignatureCanRepository
|
||||
import kr.co.vividnext.sodalive.live.tag.LiveTag
|
||||
import kr.co.vividnext.sodalive.live.tag.LiveTagRepository
|
||||
import kr.co.vividnext.sodalive.member.DonationRankingPeriod
|
||||
import kr.co.vividnext.sodalive.member.Gender
|
||||
@@ -125,6 +126,12 @@ class LiveRoomService(
|
||||
) {
|
||||
private val tokenLocks: MutableMap<Long, ReentrantReadWriteLock> = mutableMapOf()
|
||||
|
||||
// 태그가 성인(19금) 판정에 해당하는지 여부를 계산한다.
|
||||
private fun isAdultTag(tag: LiveTag): Boolean {
|
||||
// 기존 문자열 기반 조건("음담패설")을 유지하고, 태그 속성의 isAdult도 함께 평가한다.
|
||||
return tag.tag.contains("음담패설") || tag.isAdult
|
||||
}
|
||||
|
||||
private fun formatMessage(key: String, vararg args: Any): String {
|
||||
val template = messageSource.getMessage(key, langContext.lang).orEmpty()
|
||||
return if (args.isNotEmpty()) {
|
||||
@@ -425,17 +432,22 @@ class LiveRoomService(
|
||||
"${beginDateTime.hour}_${beginDateTime.minute}"
|
||||
}
|
||||
|
||||
request.tags.forEach {
|
||||
val tag = tagRepository.findByTag(it)
|
||||
var isAdultByTags = false
|
||||
request.tags.forEach { tagText ->
|
||||
val tag = tagRepository.findByTag(tagText)
|
||||
if (tag != null) {
|
||||
room.tags.add(LiveRoomTag(room, tag))
|
||||
|
||||
if (tag.tag.contains("음담패설")) {
|
||||
room.isAdult = true
|
||||
if (isAdultTag(tag)) {
|
||||
isAdultByTags = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 태그 판정 결과를 한 번에 반영해 부수효과를 최소화한다.
|
||||
if (isAdultByTags) {
|
||||
room.isAdult = true
|
||||
}
|
||||
|
||||
val createdRoom = repository.save(room)
|
||||
// 이미지 업로드
|
||||
if (coverImage != null) {
|
||||
|
||||
Reference in New Issue
Block a user