Przeglądaj źródła

fix: update user retrieval to include image attachment in common props

Shun Miyazawa 4 miesięcy temu
rodzic
commit
840527103c
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      apps/app/src/pages/common-props/commons.ts

+ 6 - 1
apps/app/src/pages/common-props/commons.ts

@@ -153,7 +153,12 @@ export const getServerSideCommonEachProps = async (
 
 
   let currentUser: IUserHasId | undefined;
   let currentUser: IUserHasId | undefined;
   if (user != null) {
   if (user != null) {
-    currentUser = user.toObject();
+    const User = crowi.model('User');
+    const userData = await User.findById(user.id).populate({
+      path: 'imageAttachment',
+      select: 'filePathProxied',
+    });
+    currentUser = userData.toObject();
   }
   }
 
 
   // Redirect destination for page transition by next/link
   // Redirect destination for page transition by next/link