// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import Suggestion from './suggestion.jsx'; import Provider from './provider.jsx'; import ChannelStore from 'stores/channel_store.jsx'; import UserStore from 'stores/user_store.jsx'; import {autocompleteUsers} from 'actions/user_actions.jsx'; import Client from 'client/web_client.jsx'; import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; import {Constants, ActionTypes} from 'utils/constants.jsx'; import * as Utils from 'utils/utils.jsx'; import {sortChannelsByDisplayName, buildGroupChannelName} from 'utils/channel_utils.jsx'; import React from 'react'; class SwitchChannelSuggestion extends Suggestion { render() { const {item, isSelection} = this.props; let className = 'mentions__name'; if (isSelection) { className += ' suggestion--selected'; } let displayName = item.display_name; let icon = null; if (item.type === Constants.OPEN_CHANNEL) { icon =
; } else if (item.type === Constants.PRIVATE_CHANNEL) { icon =
; } else if (item.type === Constants.GM_CHANNEL) { displayName = buildGroupChannelName(item.id); icon =
{UserStore.getProfileListInChannel(item.id, true).length}
; } else { icon = (