Skip to content

Commit

Permalink
fix: 최근 활동 이력에 관리자 정보 포함된 경우 쿼리 호출 제외
Browse files Browse the repository at this point in the history
  • Loading branch information
psychology50 committed Nov 5, 2024
1 parent 0eff69d commit c249a3e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public ChatRoomRes.RoomWithParticipants execute(Long userId, Long chatRoomId) {
chatMemberService.readChatMembersByUserIdIn(chatRoomId, recentParticipantIds)
);

// 내가 관리자가 아닌 경우, 관리자 정보 조회
if (!myInfo.getRole().equals(ChatMemberRole.ADMIN)) {
// 내가 관리자가 아니거나, 최근 활동자에 관리자가 없다면 관리자 정보 조회
if (!myInfo.getRole().equals(ChatMemberRole.ADMIN) || recentParticipants.stream().noneMatch(participant -> participant.role().equals(ChatMemberRole.ADMIN))) {
ChatMemberResult.Detail admin = chatMemberService.readAdmin(chatRoomId)
.orElseThrow(() -> new ChatMemberErrorException(ChatMemberErrorCode.NOT_FOUND));
recentParticipantIds.add(admin.userId());
Expand Down

0 comments on commit c249a3e

Please sign in to comment.