Skip to content

fix: getChatRooms에서 GROUP 채팅방 누락 버그 수정#497

Merged
dh2906 merged 1 commit intodevelopfrom
fix/quit-chat-room
Apr 4, 2026
Merged

fix: getChatRooms에서 GROUP 채팅방 누락 버그 수정#497
dh2906 merged 1 commit intodevelopfrom
fix/quit-chat-room

Conversation

@dh2906
Copy link
Copy Markdown
Contributor

@dh2906 dh2906 commented Apr 4, 2026

🔍 개요


🚀 주요 변경 내용

  • getAccessibleChatRooms()GROUP 타입을 처리하지 않아 GROUP 채팅방이 조회되지 않았음

  • 직접 구성한 rooms 리스트를 반환하도록 변경


💬 참고 사항


✅ Checklist (완료 조건)

  • 코드 스타일 가이드 준수
  • 테스트 코드 포함됨
  • Reviewers / Assignees / Labels 지정 완료
  • 보안 및 민감 정보 검증 (API 키, 환경 변수, 개인정보 등)

@dh2906 dh2906 self-assigned this Apr 4, 2026
@dh2906 dh2906 added the 버그 정상적으로 동작하지 않는 문제 상황 관련 이슈입니다. label Apr 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 4, 2026

📝 Walkthrough

요약

ChatService의 getChatRooms 메서드가 반환하는 데이터 소스를 변경했습니다. 기존의 AccessibleChatRooms 경로를 통한 데이터 대신, 로컬에서 정렬된 룸 요약 목록을 직접 반환하도록 수정했습니다.

변경 사항

Cohort / File(s) Summary
ChatService 메서드 로직
src/main/java/gg/agit/konect/domain/chat/service/ChatService.java
getChatRooms() 메서드가 이제 로컬 정렬 목록을 사용하여 ChatRoomsSummaryResponse를 반환하며, 기존의 getAccessibleChatRooms(userId).rooms() 호출 경로를 제거했습니다. 뮤트 상태와 해석된 룸 이름을 포함하는 기존 로컬 정렬 논리를 유지합니다.

예상 코드 리뷰 난이도

🎯 2 (Simple) | ⏱️ ~8분

🐰 한 줄의 변화, 경로를 바꾸네
로컬 정렬 목록이 이제 나설 차례
뮤트 상태와 룸 이름이 함께
더욱 선명하게 정렬되어 흐르네
작은 수정이 큰 선명함을 가져오는 마법✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed 풀 리퀘스트 제목이 변경 사항의 주요 내용을 명확하게 설명합니다. 'getChatRooms에서 GROUP 채팅방 누락 버그 수정'은 실제 변경 사항(GROUP 채팅방 반환 문제 해결)을 직접적으로 반영합니다.
Description check ✅ Passed 풀 리퀘스트 설명이 변경 사항과 관련성이 있습니다. 버그 원인(getAccessibleChatRooms()가 GROUP 타입을 처리하지 않음), 해결 방법(직접 구성한 rooms 리스트 반환)을 설명하고 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/quit-chat-room

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/main/java/gg/agit/konect/domain/chat/service/ChatService.java (2)

868-891: ⚠️ Potential issue | 🟠 Major

[LEVEL: medium] getAccessibleChatRooms에서 GROUP 채팅방 누락으로 검색 기능 불완전

searchChats(line 276)가 여전히 getAccessibleChatRooms를 사용하는데, 이 메서드는 groupRooms를 포함하지 않음. 사용자가 GROUP 채팅방 목록은 볼 수 있지만 해당 채팅방의 메시지 검색은 불가능한 불일치가 발생함. getAccessibleChatRooms에도 getGroupChatRooms(userId)를 추가하거나, 별도의 검색용 메서드로 분리하는 것을 권장함.

🔧 수정 제안
 private AccessibleChatRooms getAccessibleChatRooms(Integer userId) {
     chatRoomMembershipService.ensureClubRoomMemberships(userId);

     List<ChatRoomSummaryResponse> directRooms = getDirectChatRooms(userId);
     List<ChatRoomSummaryResponse> clubRooms = getClubChatRooms(userId);
+    List<ChatRoomSummaryResponse> groupRooms = getGroupChatRooms(userId);

     List<Integer> roomIds = new ArrayList<>();
     roomIds.addAll(directRooms.stream().map(ChatRoomSummaryResponse::roomId).toList());
     roomIds.addAll(clubRooms.stream().map(ChatRoomSummaryResponse::roomId).toList());
+    roomIds.addAll(groupRooms.stream().map(ChatRoomSummaryResponse::roomId).toList());

     Map<Integer, Boolean> muteMap = getMuteMap(roomIds, userId);
     Map<Integer, String> customRoomNameMap = getCustomRoomNameMap(roomIds, userId);
-    Map<Integer, String> defaultRoomNameMap = getDefaultRoomNameMap(directRooms, clubRooms);
+    Map<Integer, String> defaultRoomNameMap = getDefaultRoomNameMap(directRooms, clubRooms, groupRooms);
     List<ChatRoomSummaryResponse> rooms = new ArrayList<>();
     directRooms.forEach(room -> rooms.add(applyRoomSettings(room, muteMap, customRoomNameMap)));
     clubRooms.forEach(room -> rooms.add(applyRoomSettings(room, muteMap, customRoomNameMap)));
+    groupRooms.forEach(room -> rooms.add(applyRoomSettings(room, muteMap, customRoomNameMap)));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/gg/agit/konect/domain/chat/service/ChatService.java` around
lines 868 - 891, getAccessibleChatRooms currently builds accessible rooms from
getDirectChatRooms and getClubChatRooms but omits getGroupChatRooms, causing
searchChats (which relies on getAccessibleChatRooms) to miss GROUP room
messages; fix by updating getAccessibleChatRooms to also call
getGroupChatRooms(userId), include those ChatRoomSummaryResponse entries into
roomIds and rooms (applyRoomSettings) and ensure defaultRoomNameMap generation
includes groupRooms (or factor out a shared helper used by searchChats and
getAccessibleChatRooms so both include direct, club, and group rooms); reference
getAccessibleChatRooms, getGroupChatRooms, getDirectChatRooms, getClubChatRooms,
applyRoomSettings, getMuteMap, getCustomRoomNameMap, getDefaultRoomNameMap, and
searchChats when making the change.

211-272: 🧹 Nitpick | 🔵 Trivial

[LEVEL: low] getChatRoomsgetAccessibleChatRooms 간 중복 로직 존재

두 메서드 모두 ensureClubRoomMemberships, getDirectChatRooms, getClubChatRooms 호출 및 muteMap/customRoomNameMap 적용 로직이 중복됨. getAccessibleChatRooms에 GROUP 지원을 추가한 후 getChatRooms에서 재사용하면 유지보수성이 개선됨.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/gg/agit/konect/domain/chat/service/ChatService.java` around
lines 211 - 272, Refactor duplicated logic between getChatRooms and
getAccessibleChatRooms by extracting the common flow (calling
chatRoomMembershipService.ensureClubRoomMemberships, fetching direct/club/group
rooms via getDirectChatRooms/getClubChatRooms/getGroupChatRooms, building
roomIds, fetching getMuteMap and getCustomRoomNameMap, applying resolveRoomName
and constructing ChatRoomSummaryResponse objects, then sorting) into a single
reusable helper (or extend getAccessibleChatRooms) that accepts a userId and a
flag or enum to include GROUP rooms; then update getChatRooms to call that
helper (or reuse getAccessibleChatRooms) so the mute/custom-name resolution and
sorting logic is centralized while preserving resolveRoomName, getMuteMap, and
getCustomRoomNameMap usage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/main/java/gg/agit/konect/domain/chat/service/ChatService.java`:
- Around line 868-891: getAccessibleChatRooms currently builds accessible rooms
from getDirectChatRooms and getClubChatRooms but omits getGroupChatRooms,
causing searchChats (which relies on getAccessibleChatRooms) to miss GROUP room
messages; fix by updating getAccessibleChatRooms to also call
getGroupChatRooms(userId), include those ChatRoomSummaryResponse entries into
roomIds and rooms (applyRoomSettings) and ensure defaultRoomNameMap generation
includes groupRooms (or factor out a shared helper used by searchChats and
getAccessibleChatRooms so both include direct, club, and group rooms); reference
getAccessibleChatRooms, getGroupChatRooms, getDirectChatRooms, getClubChatRooms,
applyRoomSettings, getMuteMap, getCustomRoomNameMap, getDefaultRoomNameMap, and
searchChats when making the change.
- Around line 211-272: Refactor duplicated logic between getChatRooms and
getAccessibleChatRooms by extracting the common flow (calling
chatRoomMembershipService.ensureClubRoomMemberships, fetching direct/club/group
rooms via getDirectChatRooms/getClubChatRooms/getGroupChatRooms, building
roomIds, fetching getMuteMap and getCustomRoomNameMap, applying resolveRoomName
and constructing ChatRoomSummaryResponse objects, then sorting) into a single
reusable helper (or extend getAccessibleChatRooms) that accepts a userId and a
flag or enum to include GROUP rooms; then update getChatRooms to call that
helper (or reuse getAccessibleChatRooms) so the mute/custom-name resolution and
sorting logic is centralized while preserving resolveRoomName, getMuteMap, and
getCustomRoomNameMap usage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 056ceced-94b5-4ba4-8b70-060c5b6c0989

📥 Commits

Reviewing files that changed from the base of the PR and between af24113 and bf9ee88.

📒 Files selected for processing (1)
  • src/main/java/gg/agit/konect/domain/chat/service/ChatService.java
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
src/main/java/**/*.java

⚙️ CodeRabbit configuration file

src/main/java/**/*.java: 아래 원칙으로 리뷰 코멘트를 작성한다.

  • 코멘트는 반드시 한국어로 작성한다.
  • 반드시 수정이 필요한 항목만 코멘트로 남기고, 단순 취향 차이는 지적하지 않는다.
  • 각 코멘트 첫 줄에 심각도를 [LEVEL: high|medium|low] 형식으로 반드시 표기한다.
  • 심각도 기준: high=운영 장애 가능, medium=품질 저하, low=개선 권고.
  • 각 코멘트는 "문제 -> 영향 -> 제안" 순서로 3문장 이내로 간결하게 작성한다.
  • 가능하면 재현 조건 및 실패 시나리오도 포함한다.
  • 제안은 현재 코드베이스(Spring Boot + JPA + Flyway) 패턴과 일치해야 한다.
  • 보안, 트랜잭션 경계, 예외 처리, N+1, 성능 회귀 가능성을 우선 점검한다.
  • 가독성: 변수/메서드 이름이 의도를 바로 드러내는지, 중첩과 메서드 길이가 과도하지 않은지 점검한다.
  • 단순화: 불필요한 추상화, 중복 로직, 과한 방어 코드가 있으면 더 단순한 대안을 제시한다.
  • 확장성: 새 요구사항 추가 시 변경 범위가 최소화되는 구조인지(하드코딩 분기/값 여부 포함) 점검한다.

Files:

  • src/main/java/gg/agit/konect/domain/chat/service/ChatService.java
**/*

⚙️ CodeRabbit configuration file

**/*: 공통 리뷰 톤 가이드:

  • 모든 코멘트는 첫 줄에 [LEVEL: ...] 태그를 포함한다.
  • 과장된 표현 없이 사실 기반으로 작성한다.
  • 한 코멘트에는 하나의 이슈만 다룬다.
  • 코드 예시가 필요하면 최소 수정 예시를 제시한다.
  • 가독성/단순화/확장성 이슈를 발견하면 우선순위를 높여 코멘트한다.

Files:

  • src/main/java/gg/agit/konect/domain/chat/service/ChatService.java
🔇 Additional comments (1)
src/main/java/gg/agit/konect/domain/chat/service/ChatService.java (1)

271-271: [LEVEL: low] LGTM - GROUP 채팅방 누락 버그가 올바르게 수정됨

로컬에서 구성한 rooms 리스트를 직접 반환하여 getAccessibleChatRooms()가 GROUP 타입을 처리하지 않던 문제를 해결함. directRooms, clubRooms, groupRooms 세 가지 타입 모두 포함되어 정상 동작함.

@dh2906 dh2906 merged commit 4c38d56 into develop Apr 4, 2026
4 checks passed
@dh2906 dh2906 deleted the fix/quit-chat-room branch April 4, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

버그 정상적으로 동작하지 않는 문제 상황 관련 이슈입니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant