Shun Miyazawa 4 years ago
parent
commit
5dee202d8b

+ 1 - 1
packages/app/src/components/InAppNotification/TargetModel/Page/snapshot.ts

@@ -1,6 +1,6 @@
 import { IPage } from '~/interfaces/page';
 import { IPage } from '~/interfaces/page';
 
 
-export const parsePageModel = (page: IPage): string => {
+export const stringifyPageModel = (page: IPage): string => {
   return JSON.stringify({
   return JSON.stringify({
     path: page.path,
     path: page.path,
     creator: page.creator,
     creator: page.creator,

+ 2 - 2
packages/app/src/server/service/comment.ts

@@ -4,7 +4,7 @@ import loggerFactory from '../../utils/logger';
 import ActivityDefine from '../util/activityDefine';
 import ActivityDefine from '../util/activityDefine';
 import Crowi from '../crowi';
 import Crowi from '../crowi';
 
 
-import { parsePageModel } from '../../components/InAppNotification/TargetModel/Page/snapshot';
+import { stringifyPageModel } from '../../components/InAppNotification/TargetModel/Page/snapshot';
 
 
 const logger = loggerFactory('growi:service:CommentService');
 const logger = loggerFactory('growi:service:CommentService');
 
 
@@ -91,7 +91,7 @@ class CommentService {
   };
   };
 
 
   private createAndSendNotifications = async function(activity, page) {
   private createAndSendNotifications = async function(activity, page) {
-    const snapshot = parsePageModel(page);
+    const snapshot = stringifyPageModel(page);
 
 
     // Get user to be notified
     // Get user to be notified
     let targetUsers: Types.ObjectId[] = [];
     let targetUsers: Types.ObjectId[] = [];

+ 2 - 4
packages/app/src/server/service/page.js

@@ -1,9 +1,8 @@
 import { pagePathUtils } from '@growi/core';
 import { pagePathUtils } from '@growi/core';
-import isThisHour from 'date-fns/isThisHour/index.js';
 import loggerFactory from '~/utils/logger';
 import loggerFactory from '~/utils/logger';
 import ActivityDefine from '../util/activityDefine';
 import ActivityDefine from '../util/activityDefine';
 
 
-import { parsePageModel } from '../../components/InAppNotification/TargetModel/Page/snapshot';
+import { stringifyPageModel } from '../../components/InAppNotification/TargetModel/Page/snapshot';
 
 
 const mongoose = require('mongoose');
 const mongoose = require('mongoose');
 const escapeStringRegexp = require('escape-string-regexp');
 const escapeStringRegexp = require('escape-string-regexp');
@@ -811,10 +810,9 @@ class PageService {
   }
   }
 
 
   createAndSendNotifications = async function(page, user, action) {
   createAndSendNotifications = async function(page, user, action) {
-
     const { activityService, inAppNotificationService } = this.crowi;
     const { activityService, inAppNotificationService } = this.crowi;
 
 
-    const snapshot = parsePageModel(page);
+    const snapshot = stringifyPageModel(page);
 
 
     // Create activity
     // Create activity
     const parameters = {
     const parameters = {