diff --git a/src/main/java/com/hangang/HangangRiver/meeting/service/MeetingCommService.java b/src/main/java/com/hangang/HangangRiver/meeting/service/MeetingCommService.java index 6e79a22..b56a2bf 100644 --- a/src/main/java/com/hangang/HangangRiver/meeting/service/MeetingCommService.java +++ b/src/main/java/com/hangang/HangangRiver/meeting/service/MeetingCommService.java @@ -20,18 +20,19 @@ public class MeetingCommService extends MeetingBaseService{ public Comment createComment(Comment comment) throws InvalidMeetingException, IOException { // 1. Check the target meeting to be valid int meeting_seq = comment.getMeeting_seq(); + MeetingDetail meetingDetail = meetingDetailMapper.detail(meeting_seq); - if (meetingDetailMapper.isExistMeetingDetail(meeting_seq)) { - commentMapper.insert(comment); + if (meetingDetail == null) { + throw new InvalidMeetingException(); + } - MeetingDetail meetingDetail = meetingDetailMapper.detail(meeting_seq); - pushMessage(meetingDetail.getUser_id(), ADD_COMMENT_MSG); + commentMapper.insert(comment); - return comment; - } - else { - throw new InvalidMeetingException(); + if(comment.getUser_id().compareTo(meetingDetail.getUser_id()) != 0){ + pushMessage(meetingDetail.getUser_id(), ADD_COMMENT_MSG); } + + return comment; } public List getCommentsByMeeting(int meeting_seq){