revert: 通知取消异步,并且采用事务,看看能否解决 400

This commit is contained in:
tim
2025-08-05 23:26:15 +08:00
parent caba1c6658
commit 4e0dda3a24

View File

@@ -51,10 +51,7 @@ public class NotificationService {
pushNotificationService.sendNotification(user, buildPayload(body, url));
}
public Notification createNotification(User user, NotificationType type, Post post, Comment comment, Boolean approved) {
return createNotification(user, type, post, comment, approved, null, null, null);
}
@Transactional
public Notification createNotification(User user, NotificationType type, Post post, Comment comment, Boolean approved,
User fromUser, ReactionType reactionType, String content) {
Notification n = new Notification();
@@ -71,7 +68,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);
@@ -95,7 +92,7 @@ public class NotificationService {
// }
// }
}
});
// });
return n;
}