diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-02-08 14:33:15 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-02-08 14:33:15 -0500 |
commit | 3ca75906e0d311efa9fe40c93e0bf65263e63f0e (patch) | |
tree | 92124ddd3c1199120fe012ccf351e40809940c5d /web | |
parent | 8f90fd5989e0bf725b3b2593054e620028de4952 (diff) | |
parent | 5681ee79c17d3f658e20f4a704efe029cef259f9 (diff) | |
download | chat-3ca75906e0d311efa9fe40c93e0bf65263e63f0e.tar.gz chat-3ca75906e0d311efa9fe40c93e0bf65263e63f0e.tar.bz2 chat-3ca75906e0d311efa9fe40c93e0bf65263e63f0e.zip |
Merge pull request #2103 from mattermost/plt-1884
PLT-1884 Fix pending posts not updating to failed
Diffstat (limited to 'web')
-rw-r--r-- | web/react/stores/post_store.jsx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index b0f421b60..b5bb93576 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -376,15 +376,16 @@ class PostStoreClass extends EventEmitter { } storePendingPost(post) { - post.state = Constants.POST_LOADING; + const copyPost = JSON.parse(JSON.stringify(post)); + copyPost.state = Constants.POST_LOADING; - const postList = makePostListNonNull(this.getPendingPosts(post.channel_id)); + const postList = makePostListNonNull(this.getPendingPosts(copyPost.channel_id)); - postList.posts[post.pending_post_id] = post; - postList.order.unshift(post.pending_post_id); + postList.posts[copyPost.pending_post_id] = copyPost; + postList.order.unshift(copyPost.pending_post_id); - this.makePostsInfo(post.channel_id); - this.postsInfo[post.channel_id].pendingPosts = postList; + this.makePostsInfo(copyPost.channel_id); + this.postsInfo[copyPost.channel_id].pendingPosts = postList; this.emitChange(); } @@ -410,14 +411,15 @@ class PostStoreClass extends EventEmitter { } updatePendingPost(post) { - const postList = makePostListNonNull(this.getPendingPosts(post.channel_id)); + const copyPost = JSON.parse(JSON.stringify(post)); + const postList = makePostListNonNull(this.getPendingPosts(copyPost.channel_id)); - if (postList.order.indexOf(post.pending_post_id) === -1) { + if (postList.order.indexOf(copyPost.pending_post_id) === -1) { return; } - postList.posts[post.pending_post_id] = post; - this.postsInfo[post.channel_id].pendingPosts = postList; + postList.posts[copyPost.pending_post_id] = copyPost; + this.postsInfo[copyPost.channel_id].pendingPosts = postList; this.emitChange(); } |