Sfoglia il codice sorgente

removed unnecessary method

kaori 4 anni fa
parent
commit
23ccbec181
1 ha cambiato i file con 0 aggiunte e 48 eliminazioni
  1. 0 48
      packages/app/src/server/models/in-app-notification.ts

+ 0 - 48
packages/app/src/server/models/in-app-notification.ts

@@ -112,42 +112,6 @@ export default (crowi: Crowi) => {
       .exec();
       .exec();
   };
   };
 
 
-  inAppNotificationSchema.statics.upsertByActivity = async function(user, activity, createdAt = null) {
-    const {
-      _id: activityId, targetModel, target, action,
-    } = activity;
-
-    const now = createdAt || Date.now();
-    const lastWeek = subDays(now, 7);
-    const query = {
-      user, target, action, createdAt: { $gt: lastWeek },
-    };
-    const parameters = {
-      user,
-      targetModel,
-      target,
-      action,
-      status: STATUS_UNREAD,
-      createdAt: now,
-      $addToSet: { activities: activityId },
-    };
-
-    const options = {
-      upsert: true,
-      new: true,
-      setDefaultsOnInsert: true,
-      runValidators: true,
-    };
-
-    const inAppNotification = await InAppNotification.findOneAndUpdate(query, parameters, options);
-
-    if (inAppNotification != null) {
-      commentEvent.emit('update', inAppNotification.user);
-    }
-
-    return inAppNotification;
-  };
-
   inAppNotificationSchema.statics.removeActivity = async function(activity) {
   inAppNotificationSchema.statics.removeActivity = async function(activity) {
     const { _id, target, action } = activity;
     const { _id, target, action } = activity;
     const query = { target, action };
     const query = { target, action };
@@ -170,18 +134,6 @@ export default (crowi: Crowi) => {
     return InAppNotification.updateMany(query, parameters);
     return InAppNotification.updateMany(query, parameters);
   };
   };
 
 
-  inAppNotificationSchema.statics.open = async function(user, id) {
-    const query = { _id: id, user: user._id };
-    const parameters = { status: STATUS_OPENED };
-    const options = { new: true };
-
-    const inAppNotification = await InAppNotification.findOneAndUpdate(query, parameters, options);
-    if (inAppNotification != null) {
-      commentEvent.emit('update', inAppNotification.user);
-    }
-    return inAppNotification;
-  };
-
   inAppNotificationSchema.statics.getUnreadCountByUser = async function(user) {
   inAppNotificationSchema.statics.getUnreadCountByUser = async function(user) {
     const query = { user, status: STATUS_UNREAD };
     const query = { user, status: STATUS_UNREAD };