summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-11-14 07:38:05 -0500
committerChristopher Speller <crspeller@gmail.com>2016-11-14 07:38:05 -0500
commita25ae8fed2b72f88b6ba5a9a0a6110fab085470c (patch)
treef7873d726ad85d183c9bcd9fdcf0da43370be375 /webapp
parent602f85d2efe6b9127c0cd79618757c3ff2b0ef5b (diff)
downloadchat-a25ae8fed2b72f88b6ba5a9a0a6110fab085470c.tar.gz
chat-a25ae8fed2b72f88b6ba5a9a0a6110fab085470c.tar.bz2
chat-a25ae8fed2b72f88b6ba5a9a0a6110fab085470c.zip
Off screen edited posts no longer show up as new posts (#4485)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/actions/websocket_actions.jsx2
-rw-r--r--webapp/stores/post_store.jsx6
2 files changed, 4 insertions, 4 deletions
diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx
index 36c6cbdc9..8632f4135 100644
--- a/webapp/actions/websocket_actions.jsx
+++ b/webapp/actions/websocket_actions.jsx
@@ -180,7 +180,7 @@ function handleNewPostEvent(msg) {
function handlePostEditEvent(msg) {
// Store post
const post = JSON.parse(msg.data.post);
- PostStore.storePost(post);
+ PostStore.storePost(post, false);
PostStore.emitChange();
// Update channel state
diff --git a/webapp/stores/post_store.jsx b/webapp/stores/post_store.jsx
index a4e49fc98..fbe5cd457 100644
--- a/webapp/stores/post_store.jsx
+++ b/webapp/stores/post_store.jsx
@@ -245,7 +245,7 @@ class PostStoreClass extends EventEmitter {
this.postsInfo[id].postList = combinedPosts;
}
- storePost(post) {
+ storePost(post, isNewPost = false) {
const postList = makePostListNonNull(this.getAllPosts(post.channel_id));
if (post.pending_post_id !== '') {
@@ -255,7 +255,7 @@ class PostStoreClass extends EventEmitter {
post.pending_post_id = '';
postList.posts[post.id] = post;
- if (postList.order.indexOf(post.id) === -1) {
+ if (isNewPost && postList.order.indexOf(post.id) === -1) {
postList.order.unshift(post.id);
}
@@ -629,7 +629,7 @@ PostStore.dispatchToken = AppDispatcher.register((payload) => {
PostStore.emitChange();
break;
case ActionTypes.RECEIVED_POST:
- PostStore.storePost(action.post);
+ PostStore.storePost(action.post, true);
PostStore.emitChange();
break;
case ActionTypes.RECEIVED_EDIT_POST: