about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/autosuggest_input.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-07-28 14:37:52 +0200
committerGitHub <noreply@github.com>2019-07-28 14:37:52 +0200
commitcfb2ed78231758a79af038a964ab7f7b7b35274e (patch)
tree7f94dada733b514a2034839c3ca6fb6776487250 /app/javascript/mastodon/components/autosuggest_input.js
parent15de24a425cb07efd58db5299b043e4110fa138f (diff)
Add autosuggestions for hashtags (#11422)
Diffstat (limited to 'app/javascript/mastodon/components/autosuggest_input.js')
-rw-r--r--app/javascript/mastodon/components/autosuggest_input.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/javascript/mastodon/components/autosuggest_input.js b/app/javascript/mastodon/components/autosuggest_input.js
index c7d965b53..0df8bf64e 100644
--- a/app/javascript/mastodon/components/autosuggest_input.js
+++ b/app/javascript/mastodon/components/autosuggest_input.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';
@@ -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;