Shun Miyazawa 3 лет назад
Родитель
Сommit
d3d846e8be
1 измененных файлов с 3 добавлено и 4 удалено
  1. 3 4
      packages/app/src/server/service/activity.ts

+ 3 - 4
packages/app/src/server/service/activity.ts

@@ -39,12 +39,11 @@ class ActivityService {
     const shouldNotification = activity != null && target != null && (AllSupportedActionToNotifiedType as ReadonlyArray<string>).includes(activity.action);
     if (shouldNotification) {
       const notificationTargetUsers = await activity?.getNotificationTargetUsers();
-      let snapshotForInAppNotification: string;
       if (target != null) {
-        snapshotForInAppNotification = stringifySnapshot(target);
+        const snapshotForInAppNotification = stringifySnapshot(target);
+        await this.inAppNotificationService.upsertByActivity(notificationTargetUsers, activity, snapshotForInAppNotification);
+        await this.inAppNotificationService.emitSocketIo(notificationTargetUsers);
       }
-      await this.inAppNotificationService.upsertByActivity(notificationTargetUsers, activity, snapshotForInAppNotification);
-      await this.inAppNotificationService.emitSocketIo(notificationTargetUsers);
     }
   };