diff --git a/backend/src/main/java/com/openisle/service/NotificationService.java b/backend/src/main/java/com/openisle/service/NotificationService.java index 628c36a51..9ad4d9cdd 100644 --- a/backend/src/main/java/com/openisle/service/NotificationService.java +++ b/backend/src/main/java/com/openisle/service/NotificationService.java @@ -51,7 +51,10 @@ public class NotificationService { pushNotificationService.sendNotification(user, buildPayload(body, url)); } - @Transactional + public Notification createNotification(User user, NotificationType type, Post post, Comment comment, Boolean approved) { + return createNotification(user, type, post, comment, approved, null, null, null); + } + public Notification createNotification(User user, NotificationType type, Post post, Comment comment, Boolean approved, User fromUser, ReactionType reactionType, String content) { Notification n = new Notification(); @@ -68,7 +71,7 @@ public class NotificationService { } n = notificationRepository.save(n); -// notificationExecutor.execute(() -> { + notificationExecutor.execute(() -> { if (type == NotificationType.COMMENT_REPLY && user.getEmail() != null && post != null && comment != null) { String url = String.format("%s/posts/%d#comment-%d", websiteUrl, post.getId(), comment.getId()); emailSender.sendEmail(user.getEmail(), "有人回复了你", url); @@ -92,7 +95,7 @@ public class NotificationService { // } // } } -// }); + }); return n; }