WNomunomu 2 лет назад
Родитель
Сommit
0d2f9865da

+ 3 - 3
apps/app/src/server/models/activity.ts

@@ -111,9 +111,9 @@ activitySchema.statics.createByParameters = async function(parameters): Promise<
   return activity;
   return activity;
 };
 };
 
 
-// When using this method, ensure that activity updates are allowed using ActivityService.shoudUpdateActivity
-activitySchema.statics.updateByParameters = async function(activityId: string, parameters): Promise<IActivity> {
-  const activity = await this.findOneAndUpdate({ _id: activityId }, parameters, { new: true }) as unknown as IActivity;
+// When using this method, ensure that activity updates are allowed using ActivityService.shoudUpdate
+activitySchema.statics.updateByParameters = async function(activityId: string, parameters): Promise<ActivityDocument> {
+  const activity = await this.findOneAndUpdate({ _id: activityId }, parameters, { new: true }) as unknown as ActivityDocument;
 
 
   return activity;
   return activity;
 };
 };

+ 3 - 1
apps/app/src/server/service/in-app-notification.ts

@@ -21,7 +21,7 @@ import loggerFactory from '~/utils/logger';
 import Crowi from '../crowi';
 import Crowi from '../crowi';
 import { RoomPrefix, getRoomNameWithId } from '../util/socket-io-helpers';
 import { RoomPrefix, getRoomNameWithId } from '../util/socket-io-helpers';
 
 
-import type { PreNotifyProps, PreNotify } from './preNotify';
+import { generateInitialPreNotifyProps, type PreNotify, type PreNotifyProps } from './preNotify';
 
 
 
 
 const { STATUS_UNREAD, STATUS_UNOPENED, STATUS_OPENED } = InAppNotificationStatuses;
 const { STATUS_UNREAD, STATUS_UNOPENED, STATUS_OPENED } = InAppNotificationStatuses;
@@ -208,7 +208,9 @@ export default class InAppNotificationService {
     const shouldNotification = activity != null && target != null && (AllEssentialActions as ReadonlyArray<string>).includes(activity.action);
     const shouldNotification = activity != null && target != null && (AllEssentialActions as ReadonlyArray<string>).includes(activity.action);
     const snapshot = pageSerializers.stringifySnapshot(target);
     const snapshot = pageSerializers.stringifySnapshot(target);
     if (shouldNotification) {
     if (shouldNotification) {
+
       const props: PreNotifyProps = generateInitialPreNotifyProps();
       const props: PreNotifyProps = generateInitialPreNotifyProps();
+
       await preNotify(props);
       await preNotify(props);
 
 
       await this.upsertByActivity(props.notificationTargetUsers, activity, snapshot);
       await this.upsertByActivity(props.notificationTargetUsers, activity, snapshot);