Przeglądaj źródła

create a snapshot for the page action

Shun Miyazawa 4 lat temu
rodzic
commit
3613e5afad

+ 3 - 1
packages/app/src/components/InAppNotification/InAppNotificationElm.tsx

@@ -69,7 +69,9 @@ const InAppNotificationElm = (props: Props): JSX.Element => {
   }, []);
 
   const actionUsers = getActionUsers();
-  const pagePath = { path: notification.snapshot };
+
+  const snapshot = JSON.parse(notification.snapshot);
+  const pagePath = { path: snapshot.path };
 
   const actionType: string = notification.action;
   let actionMsg: string;

+ 7 - 1
packages/app/src/server/service/page.js

@@ -821,11 +821,17 @@ class PageService {
     };
     const activity = await activityService.createByParameters(parameters);
 
+    const snapshot = JSON.stringify({
+      path: page.path,
+      creator: page.creator,
+      lastUpdateUser: page.lastUpdateUser,
+    });
+
     // Get user to be notified
     const targetUsers = await activity.getNotificationTargetUsers();
 
     // Create and send notifications
-    await inAppNotificationService.upsertByActivity(targetUsers, activity, page.path);
+    await inAppNotificationService.upsertByActivity(targetUsers, activity, snapshot);
     await inAppNotificationService.emitSocketIo(targetUsers);
   };