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
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ public void sendMessage(Long currentUserId, ChatMessageSendRequestDTO request) {
currentUserId
);

// DIRECT 채팅 상대방이 나간 상태라면 채팅방 재노출을 위해 복구
if (chatRoom.getChatType() == ChatType.DIRECT) {
chatPartRepository.findOpponentIncludingDeleted(chatRoom.getId(), currentUserId)
.ifPresent(ChatPart::restore);
}

// 채팅 목록(lastMessage, unreadCount) 갱신용 개인 알림 이벤트 발행
eventPublisher.publishEvent(
new ChatUserNotificationEvent(receiverId, notification)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,12 @@ private DirectChatRoomResponseDTO.CreateOrEnter restoreAndConvert(
.findByChatRoomIdAndUserId(chatRoom.getId(), currentUserId)
.orElseThrow(() -> new ChatException(ChatErrorCode.CHAT_PART_NOT_FOUND));

ChatPart targetChatPart = chatPartRepository
.findByChatRoomIdAndUserId(chatRoom.getId(), targetUser.getId())
.orElseThrow(() -> new ChatException(ChatErrorCode.CHAT_PART_NOT_FOUND));

currentChatPart.restore();
targetChatPart.restore();

return ChatRoomConverter.toCreateOrEnterResponse(chatRoom, targetUser, isNew);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ private ChatRoomResponseDTO.Opponent getOpponentOrNull(
}

ChatPart opponentChatPart = chatPartRepository
.findOpponent(chatRoomId, currentUserId)
.findOpponentIncludingDeleted(chatRoomId, currentUserId)
.orElseThrow(() -> new ChatException(ChatErrorCode.CHAT_PART_NOT_FOUND));

return ChatMessageConverter.toOpponent(opponentChatPart);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Optional<ChatPart> findActiveOpponent(
WHERE cp.chatRoom.id = :chatRoomId
AND cp.user.id <> :currentUserId
""")
Optional<ChatPart> findOpponent(
Optional<ChatPart> findOpponentIncludingDeleted(
Long chatRoomId,
Long currentUserId
);
Expand Down
Loading