Skip to content

Commit

Permalink
Merge pull request #116 from jurumarble/fix/notification
Browse files Browse the repository at this point in the history
fix : 댓글, 투표 알림 메시지에 투표 제목 데이터 추가
  • Loading branch information
alsduq1117 authored Oct 22, 2023
2 parents 2c70b54 + 24c0217 commit 8f55208
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void handleDoVote(DoVoteEvent event) {
public void sendNotificationForNewComments(Long voteId) {
Vote vote = voteRepository.findById(voteId).orElseThrow(VoteNotFoundException::new);
User receiver = userRepository.findById(vote.getPostedUserId()).orElseThrow(UserNotFoundException::new);
String content = "투표에 댓글이 달렸습니다.";
String content = "[" + vote.getTitle() + "] " + "투표에 댓글이 달렸습니다.";
String url = String.valueOf(voteId);
notificationService.send(receiver, Notification.NotificationType.COMMENT, content, url);
log.info("Thread: {}, Notification sent to user: {}, type: {}, content: {}, url: {}",
Expand All @@ -57,9 +57,10 @@ public void sendNotificationForNewComments(Long voteId) {
}

public void sendNotificationsForVoters(Long voteId) {
Vote vote = voteRepository.findById(voteId).orElseThrow(VoteNotFoundException::new);
Long count = voteResultRepository.countByVoteId(voteId);
if (count % 10 == 0 && count != 0) {
String content = "투표에 " + count + "명 이상이 참여했어요!";
String content = "[" + vote.getTitle() + "] " + "투표에 " + count + "명 이상이 참여했어요!";
String url = String.valueOf(voteId);
List<VoteResult> voteResultList = voteResultRepository.findByVoteId(voteId);
sendNotificationsToVoters(content, url, voteResultList);
Expand Down

0 comments on commit 8f55208

Please sign in to comment.