Просмотр исходного кода

"SUPPORTED_ACTION_TO_NOTIFIED_TYPE" -> "SupportedActionToNotified"

Shun Miyazawa 3 лет назад
Родитель
Сommit
60b32b2f77

+ 2 - 2
packages/app/src/interfaces/activity.ts

@@ -75,7 +75,7 @@ export const SupportedAction = {
   ACTION_COMMENT_REMOVE,
 } as const;
 
-export const SUPPORTED_ACTION_TO_NOTIFIED_TYPE = {
+export const SupportedActionToNotified = {
   ACTION_PAGE_LIKE,
   ACTION_PAGE_BOOKMARK,
   ACTION_PAGE_UPDATE,
@@ -113,7 +113,7 @@ export const CommentActions = Object.values({
 export const AllSupportedTargetModel = Object.values(SupportedTargetModel);
 export const AllSupportedEventModel = Object.values(SupportedEventModel);
 export const AllSupportedAction = Object.values(SupportedAction);
-export const AllSupportedActionToNotifiedType = Object.values(SUPPORTED_ACTION_TO_NOTIFIED_TYPE);
+export const AllSupportedActionToNotified = Object.values(SupportedActionToNotified);
 
 /*
  * Type

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

@@ -1,7 +1,7 @@
 import { subDays } from 'date-fns';
 import { Types } from 'mongoose';
 
-import { AllSupportedActionToNotifiedType, SupportedAction } from '~/interfaces/activity';
+import { AllSupportedActionToNotified, SupportedAction } from '~/interfaces/activity';
 import { HasObjectId } from '~/interfaces/has-object-id';
 import { InAppNotificationStatuses, PaginateResult } from '~/interfaces/in-app-notification';
 import { IPage } from '~/interfaces/page';
@@ -53,7 +53,7 @@ export default class InAppNotificationService {
   initActivityEventListeners(): void {
     this.activityEvent.on('updated', async(activity: ActivityDocument, target: IPage) => {
       try {
-        const shouldNotification = activity != null && target != null && (AllSupportedActionToNotifiedType as ReadonlyArray<string>).includes(activity.action);
+        const shouldNotification = activity != null && target != null && (AllSupportedActionToNotified as ReadonlyArray<string>).includes(activity.action);
         if (shouldNotification) {
           await this.createInAppNotification(activity, target);
         }
@@ -200,7 +200,7 @@ export default class InAppNotificationService {
   };
 
   createInAppNotification = async function(activity: ActivityDocument, target: IPage): Promise<void> {
-    const shouldNotification = activity != null && target != null && (AllSupportedActionToNotifiedType as ReadonlyArray<string>).includes(activity.action);
+    const shouldNotification = activity != null && target != null && (AllSupportedActionToNotified as ReadonlyArray<string>).includes(activity.action);
     if (shouldNotification) {
       let mentionedUsers: IUser[] = [];
       if (activity.action === SupportedAction.ACTION_COMMENT_CREATE) {