From 4606c1f8fcc8672515e7ffa84d0093c3715ff7bf Mon Sep 17 00:00:00 2001 From: ChuYong Date: Thu, 27 Jul 2023 01:15:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9E=90=EA=B8=B0=EC=9E=90=EC=8B=A0?= =?UTF-8?q?=EC=97=90=EB=8A=94=20=EC=95=8C=EB=A6=BC=EC=97=86=EC=96=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/service/diary/UserDiaryService.kt | 3 ++- .../service/notification/NotificationService.kt | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) 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 {