[API] Fix bug

This commit is contained in:
syuilo
2017-03-03 20:28:42 +09:00
parent 66eed481ea
commit 3a58cff9b2
4 changed files with 11 additions and 11 deletions

View File

@ -26,7 +26,7 @@ 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');
}
@ -55,7 +55,7 @@ module.exports = (params, me) =>
return rej('cannot set since_id and max_id');
}
const q = userId != null
const q = userId !== undefined
? { _id: userId }
: { username_lower: username.toLowerCase() } ;

View File

@ -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, {