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 @@ -12,6 +12,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import gg.agit.konect.domain.chat.direct.model.ChatRoom;
import gg.agit.konect.domain.chat.direct.repository.ChatRoomRepository;
import gg.agit.konect.domain.chat.group.dto.GroupChatMessageResponse;
import gg.agit.konect.domain.chat.group.dto.GroupChatMessagesResponse;
import gg.agit.konect.domain.chat.group.dto.GroupChatRoomResponse;
Expand All @@ -23,6 +25,7 @@
import gg.agit.konect.domain.chat.group.repository.GroupChatReadStatusRepository;
import gg.agit.konect.domain.chat.group.repository.GroupChatRoomRepository;
import gg.agit.konect.domain.chat.group.repository.GroupRoomUnreadCountProjection;
import gg.agit.konect.domain.chat.unified.enums.ChatType;
import gg.agit.konect.domain.chat.unified.service.ChatPresenceService;
import gg.agit.konect.domain.club.model.ClubMember;
import gg.agit.konect.domain.club.repository.ClubMemberRepository;
Expand All @@ -45,6 +48,7 @@ public class GroupChatService {
private final GroupChatMessageRepository groupChatMessageRepository;
private final GroupChatReadStatusRepository groupChatReadStatusRepository;
private final NotificationMuteSettingRepository notificationMuteSettingRepository;
private final ChatRoomRepository chatRoomRepository;
private final ClubMemberRepository clubMemberRepository;
private final UserRepository userRepository;
private final ChatPresenceService chatPresenceService;
Expand Down Expand Up @@ -185,16 +189,25 @@ public GroupChatMessageResponse sendMessage(Integer clubId, Integer userId, Stri
}

@Transactional
public Boolean toggleMute(Integer clubId, Integer userId) {
validateClubMember(clubId, userId);
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;
}
Comment on lines +192 to +204
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.

GroupChatRoom room = groupChatRoomRepository.getByClubId(clubId);
Integer roomId = room.getId();
User user = userRepository.getById(userId);

return notificationMuteSettingRepository.findByTargetTypeAndTargetIdAndUserId(
NotificationTargetType.GROUP_CHAT_ROOM,
roomId,
targetType,
chatRoomId,
userId
)
.map(setting -> {
Expand All @@ -204,8 +217,8 @@ public Boolean toggleMute(Integer clubId, Integer userId) {
})
.orElseGet(() -> {
notificationMuteSettingRepository.save(NotificationMuteSetting.of(
NotificationTargetType.GROUP_CHAT_ROOM,
roomId,
targetType,
chatRoomId,
user,
true
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ ResponseEntity<UnifiedChatMessageResponse> sendMessage(
@UserId Integer userId
);

@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.
ResponseEntity<GroupChatMuteResponse> toggleGroupChatMute(
@PathVariable(value = "clubId") Integer clubId,
@RequestParam(name = "type") ChatType type,
@PathVariable(value = "chatRoomId") Integer chatRoomId,
@UserId Integer userId
);
Comment on lines +107 to 113
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
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.
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public ResponseEntity<UnifiedChatMessageResponse> sendMessage(

@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));
Comment on lines 74 to 81
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.
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gg.agit.konect.domain.notification.enums;

public enum NotificationTargetType {
DIRECT_CHAT_ROOM,
GROUP_CHAT_ROOM
}