From 64b8ed5e2552d2e955ec7e33c9e0d7f09b601053 Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Wed, 20 Apr 2016 09:44:29 -0400
Subject: Fixing jumping back to original message when recieving message in
 permalink view (#2751)

---
 webapp/components/post_focus_view.jsx | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'webapp/components/post_focus_view.jsx')

diff --git a/webapp/components/post_focus_view.jsx b/webapp/components/post_focus_view.jsx
index 7ff20c78d..f3dfb46c6 100644
--- a/webapp/components/post_focus_view.jsx
+++ b/webapp/components/post_focus_view.jsx
@@ -27,6 +27,7 @@ export default class PostFocusView extends React.Component {
 
         this.state = {
             scrollType: PostsView.SCROLL_TYPE_POST,
+            currentChannel: ChannelStore.getCurrentId().slice(),
             scrollPostId: focusedPostId,
             postList: PostStore.getVisiblePosts(focusedPostId),
             atTop: PostStore.getVisibilityAtTop(focusedPostId),
@@ -48,9 +49,13 @@ export default class PostFocusView extends React.Component {
     }
 
     onChannelChange() {
-        this.setState({
-            scrollType: PostsView.SCROLL_TYPE_POST
-        });
+        const currentChannel = ChannelStore.getCurrentId();
+        if (this.state.currentChannel !== currentChannel) {
+            this.setState({
+                currentChannel: currentChannel.slice(),
+                scrollType: PostsView.SCROLL_TYPE_POST
+            });
+        }
     }
 
     onUserChange() {
-- 
cgit v1.2.3-1-g7c22

