From c9ce2338f80bd2f88b7e09e4b6b1897cf2771779 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Mon, 5 Oct 2020 15:19:42 -0400 Subject: [PATCH] [MM-29275]: Remove first char of slash cmd autocomplete suggestion text, only if it is a top-level command (#4868) (#4873) * Remove first char of suggestion text, only if it is a slash * Check if suggestion is for a top-level command (cherry picked from commit a6779f42930dd5c9ad49d92b031e5c6ba5ed283a) Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com> --- .../slash_suggestion/slash_suggestion_item.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/components/autocomplete/slash_suggestion/slash_suggestion_item.js b/app/components/autocomplete/slash_suggestion/slash_suggestion_item.js index 98d3a466d..d75f0c4b9 100644 --- a/app/components/autocomplete/slash_suggestion/slash_suggestion_item.js +++ b/app/components/autocomplete/slash_suggestion/slash_suggestion_item.js @@ -32,11 +32,17 @@ export default class SlashSuggestionItem extends PureComponent { hint, theme, suggestion, + complete, isLandscape, } = this.props; const style = getStyleFromTheme(theme); + let suggestionText = suggestion; + if (suggestionText[0] === '/' && complete.split(' ').length === 1) { + suggestionText = suggestionText.substring(1); + } + return ( - {`${suggestion.substring(1)} ${hint}`} + {`${suggestionText} ${hint}`}