Просмотр исходного кода

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

Shun Miyazawa 4 месяцев назад
Родитель
Сommit
840527103c
1 измененных файлов с 6 добавлено и 1 удалено
  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;
   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