diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-12-15 11:40:46 -0500 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2016-12-15 13:40:46 -0300 |
commit | 7f48a7fc9d2238134414668e0b520115706b8b2d (patch) | |
tree | c7b485e0305a46e10ea997ea3450c2c040efcb95 /webapp/components/channel_invite_modal.jsx | |
parent | c35b95709e293680f882f27ab6e616bf8f92a7cc (diff) | |
download | chat-7f48a7fc9d2238134414668e0b520115706b8b2d.tar.gz chat-7f48a7fc9d2238134414668e0b520115706b8b2d.tar.bz2 chat-7f48a7fc9d2238134414668e0b520115706b8b2d.zip |
PLT-4815 Refactor 'More Channels' modal into the new modal pattern (#4742)
* Refactor 'More Channels' modal into the new modal pattern
* Fix unit test
* Readded CSS changes
Diffstat (limited to 'webapp/components/channel_invite_modal.jsx')
-rw-r--r-- | webapp/components/channel_invite_modal.jsx | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/webapp/components/channel_invite_modal.jsx b/webapp/components/channel_invite_modal.jsx index 4b72cfc40..355d23d53 100644 --- a/webapp/components/channel_invite_modal.jsx +++ b/webapp/components/channel_invite_modal.jsx @@ -13,6 +13,7 @@ import {searchUsers} from 'actions/user_actions.jsx'; import * as AsyncClient from 'utils/async_client.jsx'; import * as UserAgent from 'utils/user_agent.jsx'; +import Constants from 'utils/constants.jsx'; import React from 'react'; import {Modal} from 'react-bootstrap'; @@ -32,6 +33,7 @@ export default class ChannelInviteModal extends React.Component { this.search = this.search.bind(this); this.term = ''; + this.searchTimeoutId = 0; const channelStats = ChannelStore.getStats(props.channel.id); const teamStats = TeamStore.getCurrentStats(); @@ -113,13 +115,20 @@ export default class ChannelInviteModal extends React.Component { return; } - searchUsers( - term, - TeamStore.getCurrentId(), - {not_in_channel_id: this.props.channel.id}, - (users) => { - this.setState({search: true, users}); - } + clearTimeout(this.searchTimeoutId); + + this.searchTimeoutId = setTimeout( + () => { + searchUsers( + term, + TeamStore.getCurrentId(), + {not_in_channel_id: this.props.channel.id}, + (users) => { + this.setState({search: true, users}); + } + ); + }, + Constants.SEARCH_TIMEOUT_MILLISECONDS ); } |