Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/main/java/umc/cockple/demo/domain/chat/domain/ChatMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ public String getDisplayContent() {
return this.content;
}

boolean hasImages = this.chatMessageImgs != null && !this.chatMessageImgs.isEmpty();
boolean hasFiles = this.chatMessageFiles != null && !this.chatMessageFiles.isEmpty();

if (hasImages && hasFiles) {
return "사진과 파일을 보냈습니다.";
}

if (hasImages) {
int imageCount = this.chatMessageImgs.size();
return imageCount > 1 ?
String.format("사진 %d장을 보냈습니다.", imageCount) :
"사진을 보냈습니다.";
if (this.chatMessageImgs != null && !this.chatMessageImgs.isEmpty()) {
ChatMessageImg firstImg = this.chatMessageImgs.get(0);
int count = this.chatMessageImgs.size();

if (firstImg.getIsEmoji()) {
return "이모티콘을 보냈습니다.";
} else {
return count > 1 ?
String.format("사진 %d장을 보냈습니다.", count) :
"사진을 보냈습니다.";
}
}

if (hasFiles) {
// 파일이 있는 경우
if (this.chatMessageFiles != null && !this.chatMessageFiles.isEmpty()) {
int fileCount = this.chatMessageFiles.size();
return fileCount > 1 ?
String.format("파일 %d개를 보냈습니다.", fileCount) :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public LastMessageCacheDTO getLastMessage(Long chatRoomId) {
}

return LastMessageCacheDTO.builder()
.content(lastMessage.getContent())
.content(lastMessage.getDisplayContent())
.timestamp(lastMessage.getCreatedAt())
.messageType(lastMessage.getType().name())
.build();
Expand Down