Shun Miyazawa пре 4 година
родитељ
комит
1c0301691c
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      packages/app/src/server/service/in-app-notification.ts

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

@@ -127,13 +127,16 @@ export default class InAppNotificationService {
   };
 
   createSubscription = async function(userId: Types.ObjectId, pageId: string, targetRuleName: string): Promise<void> {
-    const inAppNotificationSettings = await InAppNotificationSettings.findOne({ userId });
+    const query = { userId };
+    const inAppNotificationSettings = await InAppNotificationSettings.findOne(query);
     if (inAppNotificationSettings != null) {
       const subscribeRule = inAppNotificationSettings.subscribeRules.find(subscribeRule => subscribeRule.name === targetRuleName);
       if (subscribeRule != null && subscribeRule.isEnabled) {
         await Subscription.subscribeByPageId(userId, pageId, STATUS_SUBSCRIBE);
       }
     }
+
+    return;
   };
 
 }