From 43c19981cf67c6b1b3c4f99a1a95fce82d743584 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Sat, 23 Jan 2016 12:15:28 -0500 Subject: Added a limit to the number of suggestions when autocompleting at mentions --- web/react/components/suggestion/at_mention_provider.jsx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'web/react/components') 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 -- cgit v1.2.3-1-g7c22