Преглед изворни кода

delete createUsersByInvitation

Shun Miyazawa пре 4 година
родитељ
комит
94757f62d5
2 измењених фајлова са 6 додато и 13 уклоњено
  1. 0 12
      src/server/models/user.js
  2. 6 1
      src/server/routes/apiv3/users.js

+ 0 - 12
src/server/models/user.js

@@ -610,18 +610,6 @@ module.exports = function(crowi) {
 
   };
 
-  userSchema.statics.createUsersByInvitation = async function(emailList) {
-    validateCrowi();
-
-    if (!Array.isArray(emailList)) {
-      debug('emailList is not array');
-    }
-
-    const afterWorkEmailList = await this.createUsersByEmailList(emailList);
-
-    return afterWorkEmailList;
-  };
-
   userSchema.statics.createUserByEmailAndPasswordAndStatus = async function(name, username, email, password, lang, status, callback) {
     const User = this;
     const newUser = new User();

+ 6 - 1
src/server/routes/apiv3/users.js

@@ -358,11 +358,16 @@ module.exports = (crowi) => {
    */
   router.post('/invite', loginRequiredStrictly, adminRequired, csrf, validator.inviteEmail, apiV3FormValidator, async(req, res) => {
 
+    const emailList = req.body.shapedEmailList;
     let afterWorkEmailList;
 
+    if (!Array.isArray(emailList)) {
+      logger.debug('emailList is not array');
+    }
+
     // Create users
     try {
-      afterWorkEmailList = await User.createUsersByInvitation(req.body.shapedEmailList);
+      afterWorkEmailList = await User.createUsersByEmailList(req.body.shapedEmailList);
     }
     catch (err) {
       const msg = 'Failed to create user';