Shun Miyazawa 2 سال پیش
والد
کامیت
c83ef5d2da
1فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 6 2
      apps/app/src/server/models/user.js

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

@@ -712,9 +712,13 @@ module.exports = function(crowi) {
 
   userSchema.statics.isExistUserByUserPagePath = async function(path) {
     const username = this.getUsernameByPath(path);
-    const user = await this.findOne({ username });
 
-    return user != null;
+    if (username == null) {
+      return false;
+    }
+
+    const isExist = (await this.count({ username })) > 0;
+    return isExist;
   };
 
   userSchema.statics.updateIsInvitationEmailSended = async function(id) {