diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2016-01-23 12:15:28 -0500 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2016-01-23 12:15:28 -0500 |
commit | 43c19981cf67c6b1b3c4f99a1a95fce82d743584 (patch) | |
tree | 23adf6318789b88187f19d453a3e8bb0b82d61ca | |
parent | 1a0b12313bd0af1724df2fc6260ef284acfc5f93 (diff) | |
download | chat-43c19981cf67c6b1b3c4f99a1a95fce82d743584.tar.gz chat-43c19981cf67c6b1b3c4f99a1a95fce82d743584.tar.bz2 chat-43c19981cf67c6b1b3c4f99a1a95fce82d743584.zip |
Added a limit to the number of suggestions when autocompleting at mentions
-rw-r--r-- | web/react/components/suggestion/at_mention_provider.jsx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/web/react/components/suggestion/at_mention_provider.jsx b/web/react/components/suggestion/at_mention_provider.jsx index 8c2893448..e502c981d 100644 --- a/web/react/components/suggestion/at_mention_provider.jsx +++ b/web/react/components/suggestion/at_mention_provider.jsx @@ -5,6 +5,8 @@ import SuggestionStore from '../../stores/suggestion_store.jsx'; import UserStore from '../../stores/user_store.jsx'; import * as Utils from '../../utils/utils.jsx'; +const MaxUserSuggestions = 40; + class AtMentionSuggestion extends React.Component { render() { const {item, isSelection, onClick} = this.props; @@ -78,6 +80,10 @@ export default class AtMentionProvider { if (user.username.startsWith(usernamePrefix)) { filtered.push(user); } + + if (filtered.length >= MaxUserSuggestions) { + break; + } } // add dummy users to represent the @all and @channel special mentions |