Skip to content

refactor: 채팅 알림 뮤트 기능 1대1 채팅에서도 적용#222

Merged
dh2906 merged 1 commit intodevelopfrom
feat/chat-mute
Feb 14, 2026
Merged

refactor: 채팅 알림 뮤트 기능 1대1 채팅에서도 적용#222
dh2906 merged 1 commit intodevelopfrom
feat/chat-mute

Conversation

@dh2906
Copy link
Contributor

@dh2906 dh2906 commented Feb 14, 2026

🔍 개요

  • close #이슈번호

🚀 주요 변경 내용

  • 기존에는 단체 채팅에서만 알림 뮤트 기능이 있었으나 1대1 채팅에서도 뮤트할 수 있도록 수정했습니다.

💬 참고 사항


✅ Checklist (완료 조건)

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

@dh2906 dh2906 requested a review from Copilot February 14, 2026 14:39
@dh2906 dh2906 merged commit 2cddacb into develop Feb 14, 2026
7 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

기존 단체 채팅에만 적용되던 알림 뮤트 설정을 1:1 채팅에서도 토글할 수 있도록, 알림 타겟 타입 확장 및 뮤트 토글 API를 “채팅방(rooms)” 기준으로 리팩터링한 PR입니다.

Changes:

  • 알림 뮤트 타겟에 DIRECT_CHAT_ROOM 추가
  • 채팅 알림 뮤트 토글 API를 type + chatRoomId 기반으로 변경
  • 뮤트 토글 서비스 로직에서 DIRECT/GROUP 분기 처리 추가

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/main/java/gg/agit/konect/domain/notification/enums/NotificationTargetType.java 알림 뮤트 식별을 위한 DIRECT 채팅 타겟 타입 추가
src/main/java/gg/agit/konect/domain/chat/unified/controller/ChatController.java 뮤트 토글 요청 파라미터를 type, chatRoomId로 변경
src/main/java/gg/agit/konect/domain/chat/unified/controller/ChatApi.java 뮤트 토글 엔드포인트 경로/시그니처를 rooms 기준으로 변경
src/main/java/gg/agit/konect/domain/chat/group/service/GroupChatService.java DIRECT/GROUP 채팅방에 대해 뮤트 설정 토글 및 저장 처리

@Operation(summary = "단체 채팅 알림 음소거를 토글한다.")
@PostMapping("/groups/{clubId}/mute")
@Operation(summary = "채팅 알림 기능 유무를 토글한다.")
@PostMapping("rooms/{chatRoomId}/mute")
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

@PostMapping 경로가 다른 엔드포인트들과 달리 앞에 "/"가 없이 선언돼 있습니다. Spring에서 동작은 할 수 있지만, 같은 인터페이스 내 다른 매핑들(예: "/rooms", "/rooms/{chatRoomId}/messages")과 스타일이 달라 문서/가독성 측면에서 혼동이 생깁니다. "/rooms/{chatRoomId}/mute" 형태로 통일해 주세요.

Suggested change
@PostMapping("rooms/{chatRoomId}/mute")
@PostMapping("/rooms/{chatRoomId}/mute")

Copilot uses AI. Check for mistakes.
Comment on lines +107 to 113
@Operation(summary = "채팅 알림 기능 유무를 토글한다.")
@PostMapping("rooms/{chatRoomId}/mute")
ResponseEntity<GroupChatMuteResponse> toggleGroupChatMute(
@PathVariable(value = "clubId") Integer clubId,
@RequestParam(name = "type") ChatType type,
@PathVariable(value = "chatRoomId") Integer chatRoomId,
@UserId Integer userId
);
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

이 엔드포인트는 1:1/단체 모두에 대한 뮤트 토글로 확장됐는데, 메서드명/응답 타입이 여전히 GroupChatMuteResponse 및 toggleGroupChatMute로 남아 있어 API 의미가 어긋납니다(스웨거에서도 "단체 채팅"으로 보일 가능성이 큼). 범용 이름(예: toggleChatMute)과 범용 응답 DTO로 변경하거나, 최소한 응답 스키마/설명을 현재 동작에 맞게 갱신해 주세요.

Copilot uses AI. Check for mistakes.
Comment on lines +107 to 113
@Operation(summary = "채팅 알림 기능 유무를 토글한다.")
@PostMapping("rooms/{chatRoomId}/mute")
ResponseEntity<GroupChatMuteResponse> toggleGroupChatMute(
@PathVariable(value = "clubId") Integer clubId,
@RequestParam(name = "type") ChatType type,
@PathVariable(value = "chatRoomId") Integer chatRoomId,
@UserId Integer userId
);
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

PR 설명/체크리스트에 "테스트 코드 포함됨"으로 되어 있으나, 본 PR 변경 파일들에는 해당 기능(1:1 채팅 뮤트 토글 및 알림 억제)을 검증하는 테스트 추가/수정이 포함돼 있지 않습니다. 체크리스트를 업데이트하거나, 최소한 이 엔드포인트 및 뮤트 적용(알림 전송 여부)까지 포함하는 테스트를 PR에 포함해 주세요.

Copilot uses AI. Check for mistakes.
Comment on lines 74 to 81
@Override
public ResponseEntity<GroupChatMuteResponse> toggleGroupChatMute(
@PathVariable(value = "clubId") Integer clubId,
@RequestParam(name = "type") ChatType type,
@PathVariable(value = "chatRoomId") Integer chatRoomId,
@UserId Integer userId
) {
Boolean isMuted = groupChatService.toggleMute(clubId, userId);
Boolean isMuted = groupChatService.toggleMute(userId, type, chatRoomId);
return ResponseEntity.ok(new GroupChatMuteResponse(isMuted));
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

mute 토글이 1:1/단체 공용으로 바뀌었는데 컨트롤러 메서드/응답이 여전히 GroupChatMuteResponse 및 toggleGroupChatMute로 남아 있어 의미가 불명확합니다. ChatApi와 함께 네이밍/응답 타입을 실제 동작(채팅방 알림 뮤트)과 일치하도록 정리해 주세요.

Copilot uses AI. Check for mistakes.
Comment on lines +192 to +204
public Boolean toggleMute(Integer userId, ChatType type, Integer chatRoomId) {
NotificationTargetType targetType;

if (type == ChatType.DIRECT) {
ChatRoom directRoom = chatRoomRepository.findById(chatRoomId)
.orElseThrow(() -> CustomException.of(ApiResponseCode.NOT_FOUND_CHAT_ROOM));
directRoom.validateIsParticipant(userId);
targetType = NotificationTargetType.DIRECT_CHAT_ROOM;
} else {
GroupChatRoom groupRoom = groupChatRoomRepository.getById(chatRoomId);
validateClubMember(groupRoom.getClub().getId(), userId);
targetType = NotificationTargetType.GROUP_CHAT_ROOM;
}
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

toggleMute에서 DIRECT_CHAT_ROOM 설정을 저장하도록 확장됐지만, 현재 코드베이스에서 1:1 채팅 알림 전송 경로(NotificationService.sendChatNotification / ChatService.sendMessage 등)에는 뮤트 설정을 조회해 알림을 건너뛰는 로직이 없습니다. 이 상태에서는 1:1 채팅에서 뮤트를 켜도 실제 푸시 알림이 계속 발송될 가능성이 높으니, DIRECT_CHAT_ROOM에 대한 뮤트 조회/필터링을 알림 전송 시점에 반드시 추가해 주세요.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant