From 4c833edc59eb4194d533df274ac9d9a7acf50f8b Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 16 Feb 2017 14:34:11 +0900 Subject: [PATCH] [API] Fix bugs --- src/api/endpoints/i/notifications.js | 4 +--- src/api/endpoints/messaging/messages.js | 2 -- src/api/endpoints/posts/mentions.js | 2 +- src/api/endpoints/users/followers.js | 2 +- src/api/endpoints/users/following.js | 2 +- src/api/endpoints/users/posts.js | 8 ++------ 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/api/endpoints/i/notifications.js b/src/api/endpoints/i/notifications.js index 02a2fb179..c91f3468e 100644 --- a/src/api/endpoints/i/notifications.js +++ b/src/api/endpoints/i/notifications.js @@ -19,14 +19,12 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Get 'following' parameter - const following = params.following === 'true'; + const following = params.following; // Get 'mark_as_read' parameter let markAsRead = params.mark_as_read; if (markAsRead == null) { markAsRead = true; - } else { - markAsRead = markAsRead === 'true'; } // Get 'type' parameter diff --git a/src/api/endpoints/messaging/messages.js b/src/api/endpoints/messaging/messages.js index 387ed3bea..2d589faa1 100644 --- a/src/api/endpoints/messaging/messages.js +++ b/src/api/endpoints/messaging/messages.js @@ -38,8 +38,6 @@ module.exports = (params, user) => let markAsRead = params.mark_as_read; if (markAsRead == null) { markAsRead = true; - } else { - markAsRead = markAsRead === 'true'; } // Get 'limit' parameter diff --git a/src/api/endpoints/posts/mentions.js b/src/api/endpoints/posts/mentions.js index dbb69bd5a..7377e3523 100644 --- a/src/api/endpoints/posts/mentions.js +++ b/src/api/endpoints/posts/mentions.js @@ -19,7 +19,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Get 'following' parameter - const following = params.following === 'true'; + const following = params.following; // Get 'limit' parameter let limit = params.limit; diff --git a/src/api/endpoints/users/followers.js b/src/api/endpoints/users/followers.js index ac6136123..fdb33b532 100644 --- a/src/api/endpoints/users/followers.js +++ b/src/api/endpoints/users/followers.js @@ -26,7 +26,7 @@ module.exports = (params, me) => } // Get 'iknow' parameter - const iknow = params.iknow === 'true'; + const iknow = params.iknow; // Get 'limit' parameter let limit = params.limit; diff --git a/src/api/endpoints/users/following.js b/src/api/endpoints/users/following.js index c1266b1d1..7849456e6 100644 --- a/src/api/endpoints/users/following.js +++ b/src/api/endpoints/users/following.js @@ -26,7 +26,7 @@ module.exports = (params, me) => } // Get 'iknow' parameter - const iknow = params.iknow === 'true'; + const iknow = params.iknow; // Get 'limit' parameter let limit = params.limit; diff --git a/src/api/endpoints/users/posts.js b/src/api/endpoints/users/posts.js index 8902cc314..6a612dc8d 100644 --- a/src/api/endpoints/users/posts.js +++ b/src/api/endpoints/users/posts.js @@ -36,17 +36,13 @@ module.exports = (params, me) => // Get 'with_replies' parameter let withReplies = params.with_replies; - if (withReplies !== undefined && withReplies !== null && withReplies === 'true') { - withReplies = true; - } else { + if (withReplies == null) { withReplies = false; } // Get 'with_media' parameter let withMedia = params.with_media; - if (withMedia !== undefined && withMedia !== null && withMedia === 'true') { - withMedia = true; - } else { + if (withMedia == null) { withMedia = false; }