diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-07-28 14:37:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-28 14:37:52 +0200 |
commit | cfb2ed78231758a79af038a964ab7f7b7b35274e (patch) | |
tree | 7f94dada733b514a2034839c3ca6fb6776487250 /app/javascript/mastodon/components/autosuggest_textarea.js | |
parent | 15de24a425cb07efd58db5299b043e4110fa138f (diff) |
Add autosuggestions for hashtags (#11422)
Diffstat (limited to 'app/javascript/mastodon/components/autosuggest_textarea.js')
-rw-r--r-- | app/javascript/mastodon/components/autosuggest_textarea.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/javascript/mastodon/components/autosuggest_textarea.js b/app/javascript/mastodon/components/autosuggest_textarea.js index b070fe3e5..2bd06d28a 100644 --- a/app/javascript/mastodon/components/autosuggest_textarea.js +++ b/app/javascript/mastodon/components/autosuggest_textarea.js @@ -1,6 +1,7 @@ import React from 'react'; import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container'; import AutosuggestEmoji from './autosuggest_emoji'; +import AutosuggestHashtag from './autosuggest_hashtag'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { isRtl } from '../rtl'; @@ -173,12 +174,12 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { const { selectedSuggestion } = this.state; let inner, key; - if (typeof suggestion === 'object') { + if (typeof suggestion === 'object' && suggestion.shortcode) { inner = <AutosuggestEmoji emoji={suggestion} />; key = suggestion.id; - } else if (suggestion[0] === '#') { - inner = suggestion; - key = suggestion; + } else if (typeof suggestion === 'object' && suggestion.name) { + inner = <AutosuggestHashtag tag={suggestion} />; + key = suggestion.name; } else { inner = <AutosuggestAccountContainer id={suggestion} />; key = suggestion; |