diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-05-31 16:14:28 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-05-31 16:14:28 -0400 |
commit | 12f659372786c9b9dd3261b4663a4e840da64372 (patch) | |
tree | ed7b3234df9ef277fa79759ced5897cc59e83049 /webapp/components/suggestion/search_user_provider.jsx | |
parent | 6e6257fccaa0c5837101dedbe7f547bc3cc6c6bb (diff) | |
download | chat-12f659372786c9b9dd3261b4663a4e840da64372.tar.gz chat-12f659372786c9b9dd3261b4663a4e840da64372.tar.bz2 chat-12f659372786c9b9dd3261b4663a4e840da64372.zip |
PLT-2643 Fixed asynchronous autocomplete incorrectly replacing text (#3167)
* Allowed different suggestions to match different text. Added a Suggestion base component. Improved text replacement used when filling in suggestions
* Fixed formatting
Diffstat (limited to 'webapp/components/suggestion/search_user_provider.jsx')
-rw-r--r-- | webapp/components/suggestion/search_user_provider.jsx | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/webapp/components/suggestion/search_user_provider.jsx b/webapp/components/suggestion/search_user_provider.jsx index b7234469a..5a9e70d0f 100644 --- a/webapp/components/suggestion/search_user_provider.jsx +++ b/webapp/components/suggestion/search_user_provider.jsx @@ -1,13 +1,15 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. +import React from 'react'; + +import Client from 'utils/web_client.jsx'; import SuggestionStore from 'stores/suggestion_store.jsx'; import UserStore from 'stores/user_store.jsx'; -import Client from 'utils/web_client.jsx'; -import React from 'react'; +import Suggestion from './suggestion.jsx'; -class SearchUserSuggestion extends React.Component { +class SearchUserSuggestion extends Suggestion { render() { const {item, isSelection, onClick} = this.props; @@ -31,12 +33,6 @@ class SearchUserSuggestion extends React.Component { } } -SearchUserSuggestion.propTypes = { - item: React.PropTypes.object.isRequired, - isSelection: React.PropTypes.bool, - onClick: React.PropTypes.func -}; - export default class SearchUserProvider { handlePretextChanged(suggestionId, pretext) { const captured = (/\bfrom:\s*(\S*)$/i).exec(pretext); @@ -58,8 +54,7 @@ export default class SearchUserProvider { const usernames = filtered.map((user) => user.username); - SuggestionStore.setMatchedPretext(suggestionId, usernamePrefix); - SuggestionStore.addSuggestions(suggestionId, usernames, filtered, SearchUserSuggestion); + SuggestionStore.addSuggestions(suggestionId, usernames, filtered, SearchUserSuggestion, usernamePrefix); } } } |