Explorar o código

use Query.prototype.exists()

Shun Miyazawa %!s(int64=2) %!d(string=hai) anos
pai
achega
740d739b47
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      apps/app/src/server/models/user.js

+ 2 - 2
apps/app/src/server/models/user.js

@@ -717,8 +717,8 @@ module.exports = function(crowi) {
       return false;
     }
 
-    const isExist = (await this.count({ username })) > 0;
-    return isExist;
+    const user = await this.exists({ username });
+    return user != null;
   };
 
   userSchema.statics.updateIsInvitationEmailSended = async function(id) {