[API] Fix bug
This commit is contained in:
parent
66eed481ea
commit
3a58cff9b2
4 changed files with 11 additions and 11 deletions
|
|
@ -25,13 +25,13 @@ module.exports = (params, me) =>
|
|||
const [username, usernameErr] = it(params.username, 'string');
|
||||
if (usernameErr) return rej('invalid username param');
|
||||
|
||||
if (userId === null && username === null) {
|
||||
if (userId === undefined && username === undefined) {
|
||||
return rej('user_id or username is required');
|
||||
}
|
||||
|
||||
const q = userId != null
|
||||
const q = userId !== undefined
|
||||
? { _id: userId }
|
||||
: { username_lower: username.toLowerCase() } ;
|
||||
: { username_lower: username.toLowerCase() };
|
||||
|
||||
// Lookup user
|
||||
const user = await User.findOne(q, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue