diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-07-28 14:37:52 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2019-09-02 10:57:44 +0200 |
commit | 3380e964497945a5e81012eee3ec65917ac0ade0 (patch) | |
tree | 3ecd7c8d1a8e71779cc0f26815425c61fe8a2ff3 /app/javascript/flavours/glitch/components/autosuggest_input.js | |
parent | 147e90f35d9aadfbe15d044f3ce48be77e26968a (diff) |
[Glitch] Add autosuggestions for hashtags
Port cfb2ed78231758a79af038a964ab7f7b7b35274e to glitch-soc Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/components/autosuggest_input.js')
-rw-r--r-- | app/javascript/flavours/glitch/components/autosuggest_input.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/javascript/flavours/glitch/components/autosuggest_input.js b/app/javascript/flavours/glitch/components/autosuggest_input.js index 5fc952d8e..f931069a9 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_input.js +++ b/app/javascript/flavours/glitch/components/autosuggest_input.js @@ -1,6 +1,7 @@ import React from 'react'; import AutosuggestAccountContainer from 'flavours/glitch/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 'flavours/glitch/util/rtl'; @@ -167,12 +168,12 @@ export default class AutosuggestInput 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; |