From e840cb612f9ddf537a0d9ec7223ea87bc15b0308 Mon Sep 17 00:00:00 2001
From: Asaad Mahmood <Unknowngi@live.com>
Date: Fri, 16 Oct 2015 18:49:10 +0500
Subject: Fixing more direct channel modal scrolling

---
 web/react/components/more_direct_channels.jsx | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

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

diff --git a/web/react/components/more_direct_channels.jsx b/web/react/components/more_direct_channels.jsx
index a599c1872..e99cdc257 100644
--- a/web/react/components/more_direct_channels.jsx
+++ b/web/react/components/more_direct_channels.jsx
@@ -193,6 +193,15 @@ export default class MoreDirectChannels extends React.Component {
         );
     }
 
+    componentDidUpdate(prevProps) {
+        if (!prevProps.show && this.props.show) {
+            $(ReactDOM.findDOMNode(this.refs.userList)).css('max-height', $(window).height() - 300);
+            if ($(window).width() > 768) {
+                $(ReactDOM.findDOMNode(this.refs.userList)).perfectScrollbar();
+            }
+        }
+    }
+
     render() {
         if (!this.props.show) {
             return null;
@@ -249,7 +258,10 @@ export default class MoreDirectChannels extends React.Component {
                             <span className='member-count'>{count}</span>
                         </div>
                     </div>
-                    <div className='user-list'>
+                    <div
+                        ref='userList'
+                        className='user-list'
+                    >
                         <table className='more-table table'>
                             <tbody>
                                 {userEntries}
-- 
cgit v1.2.3-1-g7c22

