summaryrefslogtreecommitdiffstats
path: root/webapp/components/channel_members_modal.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-12-15 11:40:46 -0500
committerenahum <nahumhbl@gmail.com>2016-12-15 13:40:46 -0300
commit7f48a7fc9d2238134414668e0b520115706b8b2d (patch)
treec7b485e0305a46e10ea997ea3450c2c040efcb95 /webapp/components/channel_members_modal.jsx
parentc35b95709e293680f882f27ab6e616bf8f92a7cc (diff)
downloadchat-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_members_modal.jsx')
-rw-r--r--webapp/components/channel_members_modal.jsx23
1 files changed, 16 insertions, 7 deletions
diff --git a/webapp/components/channel_members_modal.jsx b/webapp/components/channel_members_modal.jsx
index 3722195b9..9f6a2a2eb 100644
--- a/webapp/components/channel_members_modal.jsx
+++ b/webapp/components/channel_members_modal.jsx
@@ -13,6 +13,7 @@ import {removeUserFromChannel} from 'actions/channel_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';
@@ -33,6 +34,7 @@ export default class ChannelMembersModal extends React.Component {
this.nextPage = this.nextPage.bind(this);
this.term = '';
+ this.searchTimeoutId = 0;
const stats = ChannelStore.getStats(props.channel.id);
@@ -128,13 +130,20 @@ export default class ChannelMembersModal extends React.Component {
return;
}
- searchUsers(
- term,
- TeamStore.getCurrentId(),
- {in_channel_id: this.props.channel.id},
- (users) => {
- this.setState({search: true, users});
- }
+ clearTimeout(this.searchTimeoutId);
+
+ this.searchTimeoutId = setTimeout(
+ () => {
+ searchUsers(
+ term,
+ TeamStore.getCurrentId(),
+ {in_channel_id: this.props.channel.id},
+ (users) => {
+ this.setState({search: true, users});
+ }
+ );
+ },
+ Constants.SEARCH_TIMEOUT_MILLISECONDS
);
}