Shun Miyazawa 4 лет назад
Родитель
Сommit
257ce49c62

+ 5 - 2
packages/app/src/components/InAppNotification/InAppNotificationElm.tsx

@@ -6,6 +6,7 @@ import { HasObjectId } from '~/interfaces/has-object-id';
 import { apiv3Post } from '~/client/util/apiv3-client';
 import FormattedDistanceDate from '../FormattedDistanceDate';
 
+import { renderHogeModelNotification } from './renderTargetModel/page';
 
 interface Props {
   notification: IInAppNotification & HasObjectId
@@ -143,9 +144,11 @@ const InAppNotificationElm = (props: Props): JSX.Element => {
         <span className={`${notification.status === 'UNOPENED' ? 'grw-unopend-notification' : 'ml-2'} rounded-circle mr-3`}></span>
         {renderActionUserPictures()}
       </div>
-      {notification.targetModel === 'Page' && (
+      {/* test */}
+      {renderHogeModelNotification()}
+      {/* {notification.targetModel === 'Page' && (
         RenderPageModelNotification()
-      )}
+      )} */}
     </div>
   );
 };

+ 15 - 0
packages/app/src/components/InAppNotification/renderTargetModel/page.tsx

@@ -0,0 +1,15 @@
+import React from 'react';
+
+export const createSnapshot = (page): string => {
+  return JSON.stringify({
+    path: page.path,
+    creator: page.creator,
+    lastUpdateUser: page.lastUpdateUser,
+  });
+};
+
+export const renderHogeModelNotification = (): JSX.Element => {
+  return (
+    <div>Hello</div>
+  );
+};

+ 5 - 0
packages/app/src/server/service/page.js

@@ -3,6 +3,8 @@ import isThisHour from 'date-fns/isThisHour/index.js';
 import loggerFactory from '~/utils/logger';
 import ActivityDefine from '../util/activityDefine';
 
+import { createSnapshot } from '../../components/InAppNotification/renderTargetModel/page';
+
 const mongoose = require('mongoose');
 const escapeStringRegexp = require('escape-string-regexp');
 const streamToPromise = require('stream-to-promise');
@@ -812,6 +814,9 @@ class PageService {
 
     const { activityService, inAppNotificationService } = this.crowi;
 
+    const t = createSnapshot(page);
+    console.log(t);
+
     const snapshot = JSON.stringify({
       path: page.path,
       creator: page.creator,