Merge pull request #2103 from mattermost/plt-1884

PLT-1884 Fix pending posts not updating to failed
Этот коммит содержится в:
Christopher Speller
2016-02-08 14:33:15 -05:00
родитель 8f90fd5989 5681ee79c1
Коммит 3ca75906e0

Просмотреть файл

@@ -376,15 +376,16 @@ class PostStoreClass extends EventEmitter {
} }
storePendingPost(post) { 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.posts[copyPost.pending_post_id] = copyPost;
postList.order.unshift(post.pending_post_id); postList.order.unshift(copyPost.pending_post_id);
this.makePostsInfo(post.channel_id); this.makePostsInfo(copyPost.channel_id);
this.postsInfo[post.channel_id].pendingPosts = postList; this.postsInfo[copyPost.channel_id].pendingPosts = postList;
this.emitChange(); this.emitChange();
} }
@@ -410,14 +411,15 @@ class PostStoreClass extends EventEmitter {
} }
updatePendingPost(post) { 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; return;
} }
postList.posts[post.pending_post_id] = post; postList.posts[copyPost.pending_post_id] = copyPost;
this.postsInfo[post.channel_id].pendingPosts = postList; this.postsInfo[copyPost.channel_id].pendingPosts = postList;
this.emitChange(); this.emitChange();
} }