kaori 4 лет назад
Родитель
Сommit
eeb4ad00d2

+ 0 - 20
packages/app/src/server/models/activity.ts

@@ -232,25 +232,5 @@ activitySchema.post('save', async(savedActivity: ActivityDocument) => {
   }
 });
 
-
-/**
- * TODO: improve removeActivity that decleard in InAppNotificationService by GW-7481
- */
-
-// because mongoose's 'remove' hook fired only when remove by a method of Document (not by a Model method)
-// move 'save' hook from mongoose's events to activityEvent if I have a time.
-const activityEvent = new ActivityEvent();
-// const inAppNotificationService = new InAppNotificationService(crowi);
-
-activityEvent.on('remove', async(activity: ActivityDocument) => {
-
-  try {
-    // await inAppNotificationService.removeActivity(activity);
-  }
-  catch (err) {
-    logger.error(err);
-  }
-});
-
 const Activity = getOrCreateModel<ActivityDocument, ActivityModel>('Activity', activitySchema);
 export { Activity };

+ 0 - 26
packages/app/src/server/service/activity.ts

@@ -15,32 +15,6 @@ class ActivityService {
     this.crowi = crowi;
   }
 
-  /**
-   * TODO: improve removeActivity that decleard in InAppNotificationService by GW-7481
-   */
-
-  // because mongoose's 'remove' hook fired only when remove by a method of Document (not by a Model method)
-  // move 'save' hook from mongoose's events to activityEvent if I have a time.
-
-  onRemoveActivity = async(): Promise<void> => {
-    const ActivityEvent = this.crowi.event('activity');
-
-    const activityEvent = new ActivityEvent();
-
-    const inAppNotificationService = new InAppNotificationService(this.crowi);
-
-    activityEvent.on('remove', async(activity: ActivityDocument) => {
-
-      try {
-        await inAppNotificationService.removeActivity(activity);
-      }
-      catch (err) {
-        logger.error(err);
-      }
-    });
-  }
-
-
 }
 
 module.exports = ActivityService;

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

@@ -64,18 +64,6 @@ class InAppNotificationService {
 
   }
 
-  removeActivity = async function(activity) {
-    const { _id, target, action } = activity;
-    const query = { target, action };
-    const parameters = { $pull: { activities: _id } };
-
-    const result = await InAppNotification.updateMany(query, parameters);
-
-    await InAppNotification.removeEmpty();
-
-    return result;
-  };
-
 }
 
 module.exports = InAppNotificationService;