kaori пре 4 година
родитељ
комит
d4e3d6a67d

+ 1 - 1
packages/app/src/components/InAppNotification/InAppNotificationDropdown.tsx

@@ -91,7 +91,7 @@ const InAppNotificationDropdown: FC = (props) => {
     console.log('propsappContainerHoge', props.appContainer);
     const limit = 6;
     try {
-      const { notifications } = await props.appContainer.apiv3Get('/in-app-notification/list', { limit });
+      const notifications = await props.appContainer.apiv3Get('/in-app-notification/list', { limit });
       console.log('notificationsHoge', notifications);
       // setNotifications(notifications);
       // setIsLoaded(true);

+ 10 - 9
packages/app/src/server/models/in-app-notification.ts

@@ -84,17 +84,18 @@ inAppNotificationSchema.index({
   user: 1, target: 1, action: 1, createdAt: 1,
 });
 
-inAppNotificationSchema.statics.findLatestInAppNotificationsByUser = function(user, limitNum, offset) {
+inAppNotificationSchema.statics.findLatestInAppNotificationsByUser = async function(user, limitNum, offset) {
   const limit = limitNum || 10;
 
-  // TODO: improve populate refer to GROWI way by GW-7482
-  return InAppNotification.find({ user })
-    .sort({ createdAt: -1 })
-    .skip(offset)
-    .limit(limit)
-    .populate(['user', 'target'])
-    .populate({ path: 'activities', populate: { path: 'user' } })
-    .exec();
+  // TODO: improve populate refer to GROWI way by #78756
+  const notificatins = await InAppNotification.find({ user });
+  // .sort({ createdAt: -1 })
+  // .skip(offset)
+  // .limit(limit)
+  // .populate(['user', 'target'])
+  // .populate({ path: 'activities', populate: { path: 'user' } })
+  // .exec();
+  return notificatins;
 };
 
 inAppNotificationSchema.statics.STATUS_UNOPENED = function() {