Skip to content

Commit

Permalink
Merge pull request #108 from Team-Hands-Up/bug
Browse files Browse the repository at this point in the history
rds 한국시간으로 수정(secret.PROPERTIES), 자신의 게시글에 채팅방 생성 금지
  • Loading branch information
jjunjji authored Sep 17, 2023
2 parents 81cd0ca + cf3eea7 commit d2020e1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- run: echo "${{ secrets.FIREBASE_SECRET_KEY }}" > ./src/main/resources/firebase/handsup-9c9e7-firebase-adminsdk-ow0l5-6bb4cd6c8c.json
- run: cat ./src/main/resources/firebase/handsup-9c9e7-firebase-adminsdk-ow0l5-6bb4cd6c8c.json
- run: touch ./src/main/resources/application.properties
- run: echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.properties
- run: echo "${{ secrets.PROPERTIES }}" > ./src/main/resources/application.properties
- run: cat ./src/main/resources/application.properties

# (3) Gradle build (Test 제외)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public enum BaseResponseStatus {
EXIST_CHATROOMKEY(false, 4055, "이미 존재하는 채팅방 키입니다."),
NON_EXIST_LIKE_BOARDS(false, 4056, "다른 사람이 좋아요를 누른 게시물이 없습니다."),
NON_EXIST_CHATROOM_USER(false, 4057, "채팅방 내 존재하는 유저가 아닙니다."),
SELF_CHAT_ERROR(false, 4058, "자신이 작성한 게시글에는 채팅방을 생성할 수 없습니다."),


/**
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/back/handsUp/service/ChatService.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ public String chatAlarm(Principal principal, ChatDto.ResSendChat sendChat) throw
.build();
try {
notificationRepository.save(notificationEntity);
log.info("세이브 완={}", "complete");
firebaseCloudMessageService.sendMessageTo(fcmToken.getFcmToken(), me.getNickname(), "채팅이 도착하였습니다.");
return "채팅 알림을 성공적으로 보냈습니다.";
} catch (Exception e) {
Expand Down Expand Up @@ -195,6 +194,10 @@ public String createChat(Principal principal, ChatDto.ReqCreateChat reqCreateCha
}
User hostUser = optionalHostUser.get();

if(subUser.getUserIdx() == hostUser.getUserIdx()){
throw new BaseException(SELF_CHAT_ERROR);
}

ChatRoom chatRoom = ChatRoom.builder()
.boardIdx(board)
.subUserIdx(subUser)
Expand Down

0 comments on commit d2020e1

Please sign in to comment.