From d8bd57901e33a7057e26e782e295099ffcc0da89 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 6 Sep 2017 23:04:13 -0700 Subject: Removing webapp --- .../components/suggestion/search_user_provider.jsx | 91 ---------------------- 1 file changed, 91 deletions(-) delete mode 100644 webapp/components/suggestion/search_user_provider.jsx (limited to 'webapp/components/suggestion/search_user_provider.jsx') diff --git a/webapp/components/suggestion/search_user_provider.jsx b/webapp/components/suggestion/search_user_provider.jsx deleted file mode 100644 index f3191c408..000000000 --- a/webapp/components/suggestion/search_user_provider.jsx +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import Suggestion from './suggestion.jsx'; -import Provider from './provider.jsx'; - -import {autocompleteUsersInTeam} from 'actions/user_actions.jsx'; - -import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; -import * as Utils from 'utils/utils.jsx'; -import {ActionTypes} from 'utils/constants.jsx'; - -import React from 'react'; - -class SearchUserSuggestion extends Suggestion { - render() { - const {item, isSelection} = this.props; - - let className = 'search-autocomplete__item'; - if (isSelection) { - className += ' selected'; - } - - const username = item.username; - let description = ''; - - if ((item.first_name || item.last_name) && item.nickname) { - description = `- ${Utils.getFullName(item)} (${item.nickname})`; - } else if (item.nickname) { - description = `- (${item.nickname})`; - } else if (item.first_name || item.last_name) { - description = `- ${Utils.getFullName(item)}`; - } - - return ( -
- - -
- - {username} - - - {' '} - {description} - -
-
- ); - } -} - -export default class SearchUserProvider extends Provider { - handlePretextChanged(suggestionId, pretext) { - const captured = (/\bfrom:\s*(\S*)$/i).exec(pretext.toLowerCase()); - if (captured) { - const usernamePrefix = captured[1]; - - this.startNewRequest(suggestionId, usernamePrefix); - - autocompleteUsersInTeam( - usernamePrefix, - (data) => { - if (this.shouldCancelDispatch(usernamePrefix)) { - return; - } - - const users = Object.assign([], data.users); - const mentions = users.map((user) => user.username); - - AppDispatcher.handleServerAction({ - type: ActionTypes.SUGGESTION_RECEIVED_SUGGESTIONS, - id: suggestionId, - matchedPretext: usernamePrefix, - terms: mentions, - items: users, - component: SearchUserSuggestion - }); - } - ); - } - - return Boolean(captured); - } -} -- cgit v1.2.3-1-g7c22