From 3a58cff9b2b49c103b1d51a951ec269a8929d6df Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 3 Mar 2017 20:28:42 +0900 Subject: [API] Fix bug --- src/api/endpoints/posts/create.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/api/endpoints/posts') diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts index 3dc121305c..d558cd3018 100644 --- a/src/api/endpoints/posts/create.ts +++ b/src/api/endpoints/posts/create.ts @@ -35,7 +35,7 @@ module.exports = (params, user, app) => if (mediaIdsErr) return rej('invalid media_ids'); let files = []; - if (mediaIds !== null) { + if (mediaIds !== undefined) { // Fetch files // forEach だと途中でエラーなどがあっても return できないので // 敢えて for を使っています。 @@ -67,7 +67,7 @@ module.exports = (params, user, app) => if (repostIdErr) return rej('invalid repost_id'); let repost = null; - if (repostId !== null) { + if (repostId !== undefined) { // Fetch repost to post repost = await Post.findOne({ _id: repostId @@ -109,7 +109,7 @@ module.exports = (params, user, app) => if (inReplyToPostIdErr) return rej('invalid in_reply_to_post_id'); let inReplyToPost = null; - if (inReplyToPostId !== null) { + if (inReplyToPostId !== undefined) { // Fetch reply inReplyToPost = await Post.findOne({ _id: inReplyToPostId @@ -130,7 +130,7 @@ module.exports = (params, user, app) => if (pollErr) return rej('invalid poll'); let poll = null; - if (_poll !== null) { + if (_poll !== undefined) { const [pollChoices, pollChoicesErr] = it(params.poll).expect.array() .unique() -- cgit v1.2.3-freya