summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/async_client.jsx15
-rw-r--r--web/react/utils/markdown.jsx4
-rw-r--r--web/react/utils/utils.jsx4
3 files changed, 17 insertions, 6 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index c8676f45d..13b57092d 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;
@@ -542,7 +549,7 @@ export function getPosts(id) {
type: ActionTypes.RECEIVED_POSTS,
id: channelId,
before: true,
- numRequested: Constants.POST_CHUNK_SIZE,
+ numRequested: 0,
post_list: data
});
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx
index 8b3602a89..493916058 100644
--- a/web/react/utils/markdown.jsx
+++ b/web/react/utils/markdown.jsx
@@ -152,7 +152,7 @@ class MattermostMarkdownRenderer extends marked.Renderer {
}
codespan(text) {
- return '<pre class="text-nowrap">' + super.codespan(text) + '</pre>';
+ return '<span class="codespan__pre-wrap">' + super.codespan(text) + '</span>';
}
br() {
@@ -222,7 +222,7 @@ class MattermostMarkdownRenderer extends marked.Renderer {
}
table(header, body) {
- return `<table class="markdown__table"><thead>${header}</thead><tbody>${body}</tbody></table>`;
+ return `<div class="table-responsive"><table class="markdown__table"><thead>${header}</thead><tbody>${body}</tbody></table></div>`;
}
listitem(text) {
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);