From 4e0dda3a24327c9a30780154d2ca0a6bcc095edf Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 5 Aug 2025 23:26:15 +0800 Subject: [PATCH 1/6] =?UTF-8?q?revert:=20=E9=80=9A=E7=9F=A5=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=BC=82=E6=AD=A5=EF=BC=8C=E5=B9=B6=E4=B8=94=E9=87=87?= =?UTF-8?q?=E7=94=A8=E4=BA=8B=E5=8A=A1=EF=BC=8C=E7=9C=8B=E7=9C=8B=E8=83=BD?= =?UTF-8?q?=E5=90=A6=E8=A7=A3=E5=86=B3=20400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/openisle/service/NotificationService.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/com/openisle/service/NotificationService.java b/backend/src/main/java/com/openisle/service/NotificationService.java index 9ad4d9cdd..628c36a51 100644 --- a/backend/src/main/java/com/openisle/service/NotificationService.java +++ b/backend/src/main/java/com/openisle/service/NotificationService.java @@ -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; } From 26ed082f9365f473d0e586af62b88996ed0c1a19 Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 5 Aug 2025 23:54:40 +0800 Subject: [PATCH 2/6] =?UTF-8?q?Revert=20"revert:=20=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=BC=82=E6=AD=A5=EF=BC=8C=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=E9=87=87=E7=94=A8=E4=BA=8B=E5=8A=A1=EF=BC=8C=E7=9C=8B=E7=9C=8B?= =?UTF-8?q?=E8=83=BD=E5=90=A6=E8=A7=A3=E5=86=B3=20400"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4e0dda3a24327c9a30780154d2ca0a6bcc095edf. --- .../java/com/openisle/service/NotificationService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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; } From 472db0174b0c0cba114f67ffcee18b7e63409917 Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 5 Aug 2025 23:59:15 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20=E5=81=B6=E7=8E=B0400=E9=94=99?= =?UTF-8?q?=E8=AF=AF=EF=BC=8C=E7=BA=BF=E7=A8=8B=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openisle/service/NotificationService.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/com/openisle/service/NotificationService.java b/backend/src/main/java/com/openisle/service/NotificationService.java index 9ad4d9cdd..40c48bc9f 100644 --- a/backend/src/main/java/com/openisle/service/NotificationService.java +++ b/backend/src/main/java/com/openisle/service/NotificationService.java @@ -10,7 +10,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.transaction.annotation.Transactional; - ++import org.springframework.transaction.support.TransactionSynchronization; ++import org.springframework.transaction.support.TransactionSynchronizationManager; import java.util.Map; import java.util.regex.Pattern; @@ -71,7 +72,7 @@ public class NotificationService { } n = notificationRepository.save(n); - notificationExecutor.execute(() -> { + Runnable asyncTask = () -> { 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 +96,18 @@ public class NotificationService { // } // } } - }); + }; + + if (TransactionSynchronizationManager.isSynchronizationActive()) { + TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { + @Override + public void afterCommit() { + notificationExecutor.execute(asyncTask); + } + }); + } else { + notificationExecutor.execute(asyncTask); + } return n; } From 004924815bfb3393a1705718ae32888237a7a570 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 6 Aug 2025 00:09:12 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20=E5=81=B6=E7=8E=B0400=E9=94=99?= =?UTF-8?q?=E8=AF=AF=EF=BC=8C=E7=BA=BF=E7=A8=8B=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/openisle/service/NotificationService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/openisle/service/NotificationService.java b/backend/src/main/java/com/openisle/service/NotificationService.java index 40c48bc9f..9fbc595f2 100644 --- a/backend/src/main/java/com/openisle/service/NotificationService.java +++ b/backend/src/main/java/com/openisle/service/NotificationService.java @@ -10,8 +10,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.transaction.annotation.Transactional; -+import org.springframework.transaction.support.TransactionSynchronization; -+import org.springframework.transaction.support.TransactionSynchronizationManager; +import org.springframework.transaction.support.TransactionSynchronization; +import org.springframework.transaction.support.TransactionSynchronizationManager; import java.util.Map; import java.util.regex.Pattern; From f0d1caf5f32c9fe3647419d574c22969d634c94d Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 6 Aug 2025 01:45:46 +0800 Subject: [PATCH 5/6] =?UTF-8?q?feat:=20=E5=8E=BB=E9=99=A4=E5=A4=9A?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E6=93=8D=E4=BD=9C=20=E8=A7=84=E9=81=BF400?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openisle/service/NotificationService.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/backend/src/main/java/com/openisle/service/NotificationService.java b/backend/src/main/java/com/openisle/service/NotificationService.java index 9fbc595f2..86335151b 100644 --- a/backend/src/main/java/com/openisle/service/NotificationService.java +++ b/backend/src/main/java/com/openisle/service/NotificationService.java @@ -72,7 +72,7 @@ public class NotificationService { } n = notificationRepository.save(n); - Runnable asyncTask = () -> { +// Runnable asyncTask = () -> { 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); @@ -96,18 +96,18 @@ public class NotificationService { // } // } } - }; +// }; - if (TransactionSynchronizationManager.isSynchronizationActive()) { - TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { - @Override - public void afterCommit() { - notificationExecutor.execute(asyncTask); - } - }); - } else { - notificationExecutor.execute(asyncTask); - } +// if (TransactionSynchronizationManager.isSynchronizationActive()) { +// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { +// @Override +// public void afterCommit() { +// notificationExecutor.execute(asyncTask); +// } +// }); +// } else { +// notificationExecutor.execute(asyncTask); +// } return n; } From 5f75f342891bb184cbe03e3c71a2c85b32c5aaa4 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 6 Aug 2025 02:07:09 +0800 Subject: [PATCH 6/6] fix: callback --- frontend/src/components/CallbackPage.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/components/CallbackPage.vue b/frontend/src/components/CallbackPage.vue index 764b15a11..8fe8461c4 100644 --- a/frontend/src/components/CallbackPage.vue +++ b/frontend/src/components/CallbackPage.vue @@ -22,6 +22,7 @@ export default { flex-direction: column; align-items: center; justify-content: center; + height: 100%; } .callback-page-text {