mirror of
https://github.com/wassname/talk.git
synced 2026-10-30 13:50:47 +08:00
Cleaned up some routes
This commit is contained in:
1 parent
17813e23a9
commit
d7a6bf9e1f
6 files changed
+38
-25
No files matched your search
+14
-3
@@ -686,9 +686,20 @@ module.exports = class UsersService {
|
||||
canEditName: false,
|
||||
status: 'PENDING'
|
||||
}
|
||||
}).then((result) => {
|
||||
return result.nModified > 0 ? result :
|
||||
Promise.reject(errors.ErrPermissionUpdateUsername);
|
||||
})
|
||||
.then((result) => {
|
||||
if (result.nModified <= 0) {
|
||||
return Promise.reject(errors.ErrPermissionUpdateUsername);
|
||||
}
|
||||
|
||||
return result;
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.code === 11000) {
|
||||
throw errors.ErrUsernameTaken;
|
||||
}
|
||||
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user