From 425797eb3825b4d9f76302512bc60c552180d6fe Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Fri, 25 Sep 2015 12:17:38 -0400
Subject: Partial fix to scrolling issues. No longer jumps up from the bottom
 when RHS opens

---
 web/react/components/post_list.jsx | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

(limited to 'web/react/components/post_list.jsx')

diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx
index 218922b67..3e1e075bb 100644
--- a/web/react/components/post_list.jsx
+++ b/web/react/components/post_list.jsx
@@ -105,18 +105,18 @@ export default class PostList extends React.Component {
         UserStore.addStatusesChangeListener(this.onTimeChange);
         SocketStore.addChangeListener(this.onSocketChange);
 
-        var postHolder = $(React.findDOMNode(this.refs.postlist));
+        const postHolder = $(React.findDOMNode(this.refs.postlist));
 
-        $(window).on('resize.' + this.props.channelId, function resize() {
+        $(window).resize(() => {
             this.resize();
             if (!this.scrolled) {
                 this.scrollToBottom();
             }
-        }.bind(this));
+        });
 
-        postHolder.on('scroll', function scroll() {
-            var position = postHolder.scrollTop() + postHolder.height() + 14;
-            var bottom = postHolder[0].scrollHeight;
+        postHolder.on('scroll', () => {
+            const position = postHolder.scrollTop() + postHolder.height() + 14;
+            const bottom = postHolder[0].scrollHeight;
 
             if (position >= bottom) {
                 this.scrolled = false;
@@ -128,7 +128,7 @@ export default class PostList extends React.Component {
                 this.userHasSeenNew = true;
             }
             this.isUserScroll = true;
-        }.bind(this));
+        });
 
         $('.post-list__content div .post').removeClass('post--last');
         $('.post-list__content div:last-child .post').addClass('post--last');
@@ -146,7 +146,7 @@ export default class PostList extends React.Component {
         UserStore.removeStatusesChangeListener(this.onTimeChange);
         SocketStore.removeChangeListener(this.onSocketChange);
         $('body').off('click.userpopover');
-        $(window).off('resize.' + this.props.channelId);
+        $(window).off('resize');
         var postHolder = $(React.findDOMNode(this.refs.postlist));
         postHolder.off('scroll');
     }
-- 
cgit v1.2.3-1-g7c22

