Shun Miyazawa 3 ani în urmă
părinte
comite
1a1d956f19

+ 7 - 3
packages/app/src/server/service/comment.ts

@@ -1,7 +1,11 @@
 import { getModelSafely } from '@growi/core';
 import { Types } from 'mongoose';
 
-import { SUPPORTED_TARGET_MODEL_TYPE, SUPPORTED_ACTION_TYPE, ISnapshot } from '~/interfaces/activity';
+import {
+  SUPPORTED_TARGET_MODEL_TYPE, SUPPORTED_ACTION_TYPE, SupportedActionType, ISnapshot,
+} from '~/interfaces/activity';
+import { IPage } from '~/interfaces/page';
+import { IUserHasId } from '~/interfaces/user';
 import { stringifySnapshot } from '~/models/serializers/in-app-notification-snapshot/page';
 
 import loggerFactory from '../../utils/logger';
@@ -79,7 +83,7 @@ class CommentService {
     });
   }
 
-  private createActivity = async function(user, target, action) {
+  private createActivity = async function(user: IUserHasId, target: IPage, action: SupportedActionType) {
     const snapshot: ISnapshot = { username: user.username };
     const parameters = {
       user: user._id,
@@ -92,7 +96,7 @@ class CommentService {
     return activity;
   };
 
-  private createAndSendNotifications = async function(activity, page) {
+  private createAndSendNotifications = async function(activity, page: IPage) {
 
     // Get user to be notified
     let targetUsers: Types.ObjectId[] = [];

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

@@ -6,7 +6,9 @@ import escapeStringRegexp from 'escape-string-regexp';
 import mongoose, { ObjectId, QueryCursor } from 'mongoose';
 import streamToPromise from 'stream-to-promise';
 
-import { SUPPORTED_TARGET_MODEL_TYPE, SUPPORTED_ACTION_TYPE, ISnapshot } from '~/interfaces/activity';
+import {
+  SUPPORTED_TARGET_MODEL_TYPE, SUPPORTED_ACTION_TYPE, SupportedActionType, ISnapshot,
+} from '~/interfaces/activity';
 import { Ref } from '~/interfaces/common';
 import { V5ConversionErrCode } from '~/interfaces/errors/v5-conversion-error';
 import { HasObjectId } from '~/interfaces/has-object-id';
@@ -2231,7 +2233,7 @@ class PageService {
     return shortBodiesMap;
   }
 
-  private async createAndSendNotifications(user, target, action) {
+  private async createAndSendNotifications(user: IUserHasId, target: IPage, action: SupportedActionType) {
     const { activityService, inAppNotificationService } = this.crowi;
 
     // Create activity