Shun Miyazawa 4 лет назад
Родитель
Сommit
76c39c2f25
1 измененных файлов с 36 добавлено и 22 удалено
  1. 36 22
      src/server/routes/apiv3/users.js

+ 36 - 22
src/server/routes/apiv3/users.js

@@ -122,28 +122,42 @@ module.exports = (crowi) => {
     const { appService, mailService } = crowi;
     const appTitle = appService.getAppTitle();
 
-    await Promise.allSettled(userList.map(async(user) => {
-      if (user.password == null) {
-        return;
-      }
-
-      try {
-        return mailService.send({
-          to: user.email,
-          subject: `Invitation to ${appTitle}`,
-          template: path.join(crowi.localeDir, 'en_US/admin/userInvitation.txt'),
-          vars: {
-            email: user.email,
-            password: user.password,
-            url: crowi.appService.getSiteUrl(),
-            appTitle,
-          },
-        });
-      }
-      catch (err) {
-        return logger.debug('fail to send email: ', err);
-      }
-    }));
+    const promise = userList.map(async(user) => {
+      return mailService.send({
+        to: user.email,
+        subject: `Invitation to ${appTitle}`,
+        template: path.join(crowi.localeDir, 'en_US/admin/userInvitation.txt'),
+        vars: {
+          email: user.email,
+          password: user.password,
+          url: crowi.appService.getSiteUrl(),
+          appTitle,
+        },
+      });
+    });
+
+    // await Promise.allSettled(userList.map(async(user) => {
+    //   if (user.password == null) {
+    //     return;
+    //   }
+
+    //   try {
+    //     return mailService.send({
+    //       to: user.email,
+    //       subject: `Invitation to ${appTitle}`,
+    //       template: path.join(crowi.localeDir, 'en_US/admin/userInvitation.txt'),
+    //       vars: {
+    //         email: user.email,
+    //         password: user.password,
+    //         url: crowi.appService.getSiteUrl(),
+    //         appTitle,
+    //       },
+    //     });
+    //   }
+    //   catch (err) {
+    //     return logger.debug('fail to send email: ', err);
+    //   }
+    // }));
 
   };