summaryrefslogtreecommitdiffstats
path: root/webapp/components/more_direct_channels.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/more_direct_channels.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/more_direct_channels.jsx')
-rw-r--r--webapp/components/more_direct_channels.jsx33
1 files changed, 21 insertions, 12 deletions
diff --git a/webapp/components/more_direct_channels.jsx b/webapp/components/more_direct_channels.jsx
index 2d4780359..1b287b3b2 100644
--- a/webapp/components/more_direct_channels.jsx
+++ b/webapp/components/more_direct_channels.jsx
@@ -35,6 +35,8 @@ export default class MoreDirectChannels extends React.Component {
this.nextPage = this.nextPage.bind(this);
this.search = this.search.bind(this);
+ this.searchTimeoutId = 0;
+
this.state = {
users: null,
loadingDMChannel: -1,
@@ -168,19 +170,26 @@ export default class MoreDirectChannels extends React.Component {
teamId = TeamStore.getCurrentId();
}
- searchUsers(
- term,
- teamId,
- {},
- (users) => {
- for (let i = 0; i < users.length; i++) {
- if (users[i].id === UserStore.getCurrentId()) {
- users.splice(i, 1);
- break;
+ clearTimeout(this.searchTimeoutId);
+
+ this.searchTimeoutId = setTimeout(
+ () => {
+ searchUsers(
+ term,
+ teamId,
+ {},
+ (users) => {
+ for (let i = 0; i < users.length; i++) {
+ if (users[i].id === UserStore.getCurrentId()) {
+ users.splice(i, 1);
+ break;
+ }
+ }
+ this.setState({search: true, users});
}
- }
- this.setState({search: true, users});
- }
+ );
+ },
+ Constants.SEARCH_TIMEOUT_MILLISECONDS
);
}