diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-07-30 08:33:52 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-07-30 08:33:52 -0400 |
commit | 0c627913f775044b382f9bc115244e4eb40f4833 (patch) | |
tree | 9177af341421bd6171701ce20c0384600d2e8600 /web | |
parent | 7bc5f4e863b14febf26bb447b5267216d9d8ce42 (diff) | |
download | chat-0c627913f775044b382f9bc115244e4eb40f4833.tar.gz chat-0c627913f775044b382f9bc115244e4eb40f4833.tar.bz2 chat-0c627913f775044b382f9bc115244e4eb40f4833.zip |
removed ternary operator to make if statement clearer
Diffstat (limited to 'web')
-rw-r--r-- | web/react/utils/async_client.jsx | 5 |
1 files changed, 4 insertions, 1 deletions
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(); |