From 0c627913f775044b382f9bc115244e4eb40f4833 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Thu, 30 Jul 2015 08:33:52 -0400 Subject: removed ternary operator to make if statement clearer --- web/react/utils/async_client.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'web/react') diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index 8a1ff129d..dc4fc1096 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -285,7 +285,10 @@ module.exports.getPosts = function(force, id, maxPosts) { // if we already have more than POST_CHUNK_SIZE posts, // let's get the amount we have but rounded up to next multiple of POST_CHUNK_SIZE, // with a max at maxPosts - var numPosts = post_list && post_list.order.length > 0 ? Math.min(maxPosts, Constants.POST_CHUNK_SIZE * Math.ceil(post_list.order.length / Constants.POST_CHUNK_SIZE)) : Constants.POST_CHUNK_SIZE; + var numPosts = Math.min(maxPosts, Constants.POST_CHUNK_SIZE); + if (post_list && post_list.order.length > 0) { + numPosts = Math.min(maxPosts, Constants.POST_CHUNK_SIZE * Math.ceil(post_list.order.length / Constants.POST_CHUNK_SIZE)); + } if (channelId != null) { callTracker["getPosts_"+channelId] = utils.getTimestamp(); -- cgit v1.2.3-1-g7c22