mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-09 19:47:39 +08:00
Revert "revert: 通知取消异步,并且采用事务,看看能否解决 400"
This reverts commit 4e0dda3a24.
This commit is contained in:
@@ -51,7 +51,10 @@ public class NotificationService {
|
|||||||
pushNotificationService.sendNotification(user, buildPayload(body, url));
|
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,
|
public Notification createNotification(User user, NotificationType type, Post post, Comment comment, Boolean approved,
|
||||||
User fromUser, ReactionType reactionType, String content) {
|
User fromUser, ReactionType reactionType, String content) {
|
||||||
Notification n = new Notification();
|
Notification n = new Notification();
|
||||||
@@ -68,7 +71,7 @@ public class NotificationService {
|
|||||||
}
|
}
|
||||||
n = notificationRepository.save(n);
|
n = notificationRepository.save(n);
|
||||||
|
|
||||||
// notificationExecutor.execute(() -> {
|
notificationExecutor.execute(() -> {
|
||||||
if (type == NotificationType.COMMENT_REPLY && user.getEmail() != null && post != null && comment != null) {
|
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());
|
String url = String.format("%s/posts/%d#comment-%d", websiteUrl, post.getId(), comment.getId());
|
||||||
emailSender.sendEmail(user.getEmail(), "有人回复了你", url);
|
emailSender.sendEmail(user.getEmail(), "有人回复了你", url);
|
||||||
@@ -92,7 +95,7 @@ public class NotificationService {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user