feat(chat-room-list): 이미지 메시지면 최근 메시지를 [이미지]로 표시

This commit is contained in:
Klaus 2025-08-28 02:33:04 +09:00
parent df93f0e0ce
commit a58de0cf92
1 changed files with 10 additions and 2 deletions

View File

@ -251,9 +251,17 @@ class ChatRoomService(
).apply { id = q.chatRoomId }
val latest = messageRepository.findTopByChatRoomAndIsActiveTrueOrderByCreatedAtDesc(room)
val preview = latest?.message?.let { msg ->
val preview = if (latest?.message?.isNotBlank() == true) {
latest.message.let { msg ->
if (msg.length <= 30) msg else msg.take(30) + "..."
}
} else {
if (latest?.message.isNullOrBlank() && latest?.characterImage != null) {
"[이미지]"
} else {
""
}
}
val imageUrl = "$imageHost/${q.imagePath ?: "profile/default-profile.png"}"
val opponentType = q.characterType.name // Clone or Character