Yuki Takei 11 месяцев назад
Родитель
Сommit
b0df66f4bb
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      apps/app/src/server/routes/apiv3/users.js

+ 4 - 3
apps/app/src/server/routes/apiv3/users.js

@@ -1,4 +1,3 @@
-
 import path from 'path';
 
 import { ErrorV3 } from '@growi/core/dist/models';
@@ -332,7 +331,8 @@ module.exports = (crowi) => {
           },
         );
       }
-      if (forceIncludeAttributes.includes('email')) {
+      if (forceIncludeAttributes != null
+          && (Array.isArray(forceIncludeAttributes) ? forceIncludeAttributes.includes('email') : forceIncludeAttributes === 'email')) {
         orConditions.push({ email: { $in: searchWord } });
       }
 
@@ -350,7 +350,8 @@ module.exports = (crowi) => {
         // return email only when specified by query
         const { email } = doc;
         const user = serializeUserSecurely(doc);
-        if (forceIncludeAttributes.includes('email')) {
+        if (forceIncludeAttributes != null
+            && (Array.isArray(forceIncludeAttributes) ? forceIncludeAttributes.includes('email') : forceIncludeAttributes === 'email')) {
           user.email = email;
         }