diff options
author | Asaad Mahmood <asaad@spinpunch.com> | 2016-02-12 20:19:07 +0500 |
---|---|---|
committer | Asaad Mahmood <asaad@spinpunch.com> | 2016-02-12 20:19:07 +0500 |
commit | 7bea418a6575d8d02c1f3eb9f3dbb99fe4d90b0a (patch) | |
tree | 069222c906cbf56feb003c806f60230cdbf81844 /web/react/utils | |
parent | 6bf1203581a295e82116c23bc4fe2d9d29362cf4 (diff) | |
parent | 6cb4f82ee5a17cd1d32ae19c266b78c2cfd604e6 (diff) | |
download | chat-7bea418a6575d8d02c1f3eb9f3dbb99fe4d90b0a.tar.gz chat-7bea418a6575d8d02c1f3eb9f3dbb99fe4d90b0a.tar.bz2 chat-7bea418a6575d8d02c1f3eb9f3dbb99fe4d90b0a.zip |
Merge branch 'master' of https://github.com/mattermost/platform into ui-fixes
Diffstat (limited to 'web/react/utils')
-rw-r--r-- | web/react/utils/async_client.jsx | 13 | ||||
-rw-r--r-- | web/react/utils/utils.jsx | 4 |
2 files changed, 14 insertions, 3 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index c8676f45d..45cdf699f 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -521,18 +521,25 @@ export function getPosts(id) { return; } - if (PostStore.getAllPosts(channelId) == null) { + const postList = PostStore.getAllPosts(channelId); + + if ($.isEmptyObject(postList) || postList.order.length < Constants.POST_CHUNK_SIZE) { getPostsPage(channelId, Constants.POST_CHUNK_SIZE); return; } - const latestUpdate = PostStore.getLatestUpdate(channelId); + const latestPost = PostStore.getLatestPost(channelId); + let latestPostTime = 0; + + if (latestPost != null && latestPost.update_at != null) { + latestPostTime = latestPost.create_at; + } callTracker['getPosts_' + channelId] = utils.getTimestamp(); client.getPosts( channelId, - latestUpdate, + latestPostTime, (data, textStatus, xhr) => { if (xhr.status === 304 || !data) { return; diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index e2a5b9620..7f124149d 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -260,6 +260,10 @@ export function displayTimeFormatted(ticks) { ); } +export function isMilitaryTime() { + return PreferenceStore.getBool(Constants.Preferences.CATEGORY_DISPLAY_SETTINGS, 'use_military_time'); +} + export function displayDateTime(ticks) { var seconds = Math.floor((Date.now() - ticks) / 1000); |