Kaynağa Gözat

Create isExistUserByUserPagePath

Shun Miyazawa 2 yıl önce
ebeveyn
işleme
fb4438c752
1 değiştirilmiş dosya ile 7 ekleme ve 0 silme
  1. 7 0
      apps/app/src/server/models/user.js

+ 7 - 0
apps/app/src/server/models/user.js

@@ -710,6 +710,13 @@ module.exports = function(crowi) {
     return username;
   };
 
+  userSchema.statics.isExistUserByUserPagePath = async function(path) {
+    const username = this.getUsernameByPath(path);
+    const user = await this.findOne({ username });
+
+    return user != null;
+  };
+
   userSchema.statics.updateIsInvitationEmailSended = async function(id) {
     const user = await this.findById(id);