From a6779f42930dd5c9ad49d92b031e5c6ba5ed283a Mon Sep 17 00:00:00 2001
From: Michael Kochell <6913320+mickmister@users.noreply.github.com>
Date: Mon, 5 Oct 2020 15:08:57 -0400
Subject: [PATCH] [MM-29275]: Remove first char of slash cmd autocomplete
suggestion text, only if it is a top-level command (#4868)
* Remove first char of suggestion text, only if it is a slash
* Check if suggestion is for a top-level command
---
.../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}`}