From 9f02d2d1b8f57e0adaab1f8068982606b0d1e71f 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 02a2fb1798..c91f3468e7 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 387ed3bea1..2d589faa1c 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 dbb69bd5ac..7377e3523b 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 ac61361232..fdb33b5328 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 c1266b1d19..7849456e62 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 8902cc314c..6a612dc8df 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; }