Shun Miyazawa 2 лет назад
Родитель
Сommit
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) {