diff --git a/src/main/kotlin/co/bearus/magcloud/domain/service/diary/UserDiaryService.kt b/src/main/kotlin/co/bearus/magcloud/domain/service/diary/UserDiaryService.kt index 16add83..3642eb2 100644 --- a/src/main/kotlin/co/bearus/magcloud/domain/service/diary/UserDiaryService.kt +++ b/src/main/kotlin/co/bearus/magcloud/domain/service/diary/UserDiaryService.kt @@ -97,7 +97,8 @@ class UserDiaryService( DiaryLikeEntity.of(diaryId, userId) ) diary.likeCount = diaryLikeRepository.countByDiaryId(diaryId).toInt() - notificationService.sendDiaryLikedNotification(diaryId) + + if(userId != diary.userId) notificationService.sendDiaryLikedNotification(diaryId) return diaryRepository.save(diary).toDto() } return diary.toDto() diff --git a/src/main/kotlin/co/bearus/magcloud/domain/service/notification/NotificationService.kt b/src/main/kotlin/co/bearus/magcloud/domain/service/notification/NotificationService.kt index 9bc69c1..95e2c16 100644 --- a/src/main/kotlin/co/bearus/magcloud/domain/service/notification/NotificationService.kt +++ b/src/main/kotlin/co/bearus/magcloud/domain/service/notification/NotificationService.kt @@ -80,12 +80,13 @@ class NotificationService( fun sendCommentCreateNotification(comment: DiaryCommentDTO) { val diary = diaryRepository.findByIdOrNull(comment.diaryId) ?: return val writer = userRepository.findByIdOrNull(comment.userId) ?: return - sendMessageToUser( - notificationType = NotificationType.SOCIAL, - userId = diary.userId, - description = "${writer.name}님이 내 일기에 댓글을 달았어요!", - routePath = "/comment/${comment.diaryId}" - ) + if(comment.userId != diary.userId) + sendMessageToUser( + notificationType = NotificationType.SOCIAL, + userId = diary.userId, + description = "${writer.name}님이 내 일기에 댓글을 달았어요!", + routePath = "/comment/${comment.diaryId}" + ) val taggedPeoples = StringUtils.extractULIDFromString(comment.content) taggedPeoples.forEach {