From 3c70fb91463ead824b80e94489688e125544c412 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 29 Jul 2019 15:04:49 +0200 Subject: [Glitch] Fix emoji autosuggestions Port 784c88e16d8e0f75c0d27e34f926569607e02044 to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/components/autosuggest_input.js | 10 +++++----- .../flavours/glitch/components/autosuggest_textarea.js | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'app/javascript/flavours/glitch/components') diff --git a/app/javascript/flavours/glitch/components/autosuggest_input.js b/app/javascript/flavours/glitch/components/autosuggest_input.js index f931069a9..1ef7ee216 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_input.js +++ b/app/javascript/flavours/glitch/components/autosuggest_input.js @@ -168,15 +168,15 @@ export default class AutosuggestInput extends ImmutablePureComponent { const { selectedSuggestion } = this.state; let inner, key; - if (typeof suggestion === 'object' && suggestion.shortcode) { + if (suggestion.type === 'emoji') { inner = ; key = suggestion.id; - } else if (typeof suggestion === 'object' && suggestion.name) { + } else if (suggestion.type ==='hashtag') { inner = ; key = suggestion.name; - } else { - inner = ; - key = suggestion; + } else if (suggestion.type === 'account') { + inner = ; + key = suggestion.id; } return ( diff --git a/app/javascript/flavours/glitch/components/autosuggest_textarea.js b/app/javascript/flavours/glitch/components/autosuggest_textarea.js index c057f4a5b..ec2fbbe4b 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_textarea.js +++ b/app/javascript/flavours/glitch/components/autosuggest_textarea.js @@ -174,15 +174,15 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { const { selectedSuggestion } = this.state; let inner, key; - if (typeof suggestion === 'object' && suggestion.shortcode) { + if (suggestion.type === 'emoji') { inner = ; key = suggestion.id; - } else if (typeof suggestion === 'object' && suggestion.name) { + } else if (suggestion.type === 'hashtag') { inner = ; key = suggestion.name; - } else { - inner = ; - key = suggestion; + } else if (suggestion.type === 'account') { + inner = ; + key = suggestion.id; } return ( -- cgit