Skip to content

Commit

Permalink
Merge pull request #29 from Team-Wable/fix/#28
Browse files Browse the repository at this point in the history
[FIX] comment push alarm
  • Loading branch information
Hong0329 authored Oct 1, 2024
2 parents 8e39d96 + e84b0f1 commit cb85d27
Showing 1 changed file with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void postComment(Long memberId, Long contentId, CommentPostRequestDto com
//๋‹ต๊ธ€ ์ž‘์„ฑ ์‹œ ๊ฒŒ์‹œ๋ฌผ ์ž‘์ƒ์ž์—๊ฒŒ ์•Œ๋ฆผ ๋ฐœ์ƒ
Member contentWritingMember = memberRepository.findMemberByIdOrThrow(content.getMember().getId());

if(usingMember != contentWritingMember){ ////์ž์‹  ๊ฒŒ์‹œ๋ฌผ์— ๋Œ€ํ•œ ์ข‹์•„์š” ๋ˆ„๋ฅด๋ฉด ์•Œ๋ฆผ ๋ฐœ์ƒ x
if(usingMember != contentWritingMember) { ////์ž์‹  ๊ฒŒ์‹œ๋ฌผ์— ๋Œ€ํ•œ ์ข‹์•„์š” ๋ˆ„๋ฅด๋ฉด ์•Œ๋ฆผ ๋ฐœ์ƒ x
//๋…ธํ‹ฐ ์—”ํ‹ฐํ‹ฐ์™€ ์—ฐ๊ฒฐ
Notification notification = Notification.builder()
.notificationTargetMember(contentWritingMember)
Expand All @@ -66,29 +66,29 @@ public void postComment(Long memberId, Long contentId, CommentPostRequestDto com
.notificationText(comment.getCommentText())
.build();
Notification savedNotification = notificationRepository.save(notification);
}

if (Boolean.TRUE.equals(contentWritingMember.getIsPushAlarmAllowed())) {
String FcmMessageTitle = usingMember.getNickname() + "๋‹˜์ด ๋‹ต๊ธ€์„ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.";
contentWritingMember.increaseFcmBadge();
FcmMessageDto commentFcmMessage = FcmMessageDto.builder()
.validateOnly(false)
.message(FcmMessageDto.Message.builder()
.notificationDetails(FcmMessageDto.NotificationDetails.builder()
.title(FcmMessageTitle)
.body(commentPostRequestDto.commentText())
.build())
.token(contentWritingMember.getFcmToken())
.data(FcmMessageDto.Data.builder()
.name("comment")
.description("๋‹ต๊ธ€ ํ‘ธ์‹œ ์•Œ๋ฆผ")
.relateContentId(String.valueOf(contentId))
.build())
.badge(contentWritingMember.getFcmBadge())
.build())
.build();
if (Boolean.TRUE.equals(contentWritingMember.getIsPushAlarmAllowed())) {
String FcmMessageTitle = usingMember.getNickname() + "๋‹˜์ด ๋‹ต๊ธ€์„ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.";
contentWritingMember.increaseFcmBadge();
FcmMessageDto commentFcmMessage = FcmMessageDto.builder()
.validateOnly(false)
.message(FcmMessageDto.Message.builder()
.notificationDetails(FcmMessageDto.NotificationDetails.builder()
.title(FcmMessageTitle)
.body(commentPostRequestDto.commentText())
.build())
.token(contentWritingMember.getFcmToken())
.data(FcmMessageDto.Data.builder()
.name("comment")
.description("๋‹ต๊ธ€ ํ‘ธ์‹œ ์•Œ๋ฆผ")
.relateContentId(String.valueOf(contentId))
.build())
.badge(contentWritingMember.getFcmBadge())
.build())
.build();

fcmService.sendMessage(commentFcmMessage);
fcmService.sendMessage(commentFcmMessage);
}
}
}

Expand Down Expand Up @@ -132,7 +132,6 @@ public void postCommentVer2(Long memberId, Long contentId, MultipartFile comment
.build();
Notification savedNotification = notificationRepository.save(notification);


if (Boolean.TRUE.equals(contentWritingMember.getIsPushAlarmAllowed())) {
String FcmMessageTitle = usingMember.getNickname() + "๋‹˜์ด ๋‹ต๊ธ€์„ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.";
contentWritingMember.increaseFcmBadge();
Expand Down

0 comments on commit cb85d27

Please sign in to comment.