summaryrefslogtreecommitdiffstats
path: root/webapp/actions
diff options
context:
space:
mode:
authorDebanshu Kundu <debanshu.kundu@joshtechnologygroup.com>2017-01-25 17:48:35 +0530
committerJoram Wilander <jwawilander@gmail.com>2017-01-25 07:18:35 -0500
commit7bcea832cdd2391369c66a831d43036ebd82bdea (patch)
treecdde490b58a4189cbd8aa5f623c1efad2199297a /webapp/actions
parent88ce5d363c7fd9e77dc8e4d36c0616ad006a7e48 (diff)
downloadchat-7bcea832cdd2391369c66a831d43036ebd82bdea.tar.gz
chat-7bcea832cdd2391369c66a831d43036ebd82bdea.tar.bz2
chat-7bcea832cdd2391369c66a831d43036ebd82bdea.zip
#4967 Fixed issue of post not getting updated after edit, if the post was focused. (#5149)
Diffstat (limited to 'webapp/actions')
-rw-r--r--webapp/actions/post_actions.jsx22
1 files changed, 14 insertions, 8 deletions
diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx
index 7179b6365..3f660b94d 100644
--- a/webapp/actions/post_actions.jsx
+++ b/webapp/actions/post_actions.jsx
@@ -115,12 +115,16 @@ export function getFlaggedPosts() {
);
}
-export function loadPosts(channelId = ChannelStore.getCurrentId()) {
+export function loadPosts(channelId = ChannelStore.getCurrentId(), isPost = false) {
const postList = PostStore.getAllPosts(channelId);
const latestPostTime = PostStore.getLatestPostFromPageTime(channelId);
- if (!postList || Object.keys(postList).length === 0 || postList.order.length < Constants.POST_CHUNK_SIZE || latestPostTime === 0) {
- loadPostsPage(channelId, Constants.POST_CHUNK_SIZE);
+ if (
+ !postList || Object.keys(postList).length === 0 ||
+ (!isPost && postList.order.length < Constants.POST_CHUNK_SIZE) ||
+ latestPostTime === 0
+ ) {
+ loadPostsPage(channelId, Constants.POST_CHUNK_SIZE, isPost);
return;
}
@@ -133,7 +137,8 @@ export function loadPosts(channelId = ChannelStore.getCurrentId()) {
id: channelId,
before: true,
numRequested: 0,
- post_list: data
+ post_list: data,
+ isPost
});
loadProfilesForPosts(data.posts);
@@ -145,7 +150,7 @@ export function loadPosts(channelId = ChannelStore.getCurrentId()) {
);
}
-export function loadPostsPage(channelId = ChannelStore.getCurrentId(), max = Constants.POST_CHUNK_SIZE) {
+export function loadPostsPage(channelId = ChannelStore.getCurrentId(), max = Constants.POST_CHUNK_SIZE, isPost = false) {
const postList = PostStore.getAllPosts(channelId);
// if we already have more than POST_CHUNK_SIZE posts,
@@ -168,7 +173,8 @@ export function loadPostsPage(channelId = ChannelStore.getCurrentId(), max = Con
numRequested: numPosts,
checkLatest: true,
checkEarliest: true,
- post_list: data
+ post_list: data,
+ isPost
});
loadProfilesForPosts(data.posts);
@@ -365,11 +371,11 @@ export function createPost(post, doLoadPost, success, error) {
);
}
-export function updatePost(post, success) {
+export function updatePost(post, success, isPost) {
Client.updatePost(
post,
() => {
- loadPosts(post.channel_id);
+ loadPosts(post.channel_id, isPost);
if (success) {
success();