summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-02-09 11:24:14 -0500
committerChristopher Speller <crspeller@gmail.com>2016-02-09 11:24:14 -0500
commita4cce1023cae299a808875c00d6427003145da7d (patch)
tree2712fef5a2bb7787dc8e52cf3b2ae55d97309a5c /web/react/utils
parent63f830938b732258ea481f46076a88bfa8ebcd8c (diff)
parent8ac0e800f18167b711cacbdaa91c5013decb79bf (diff)
downloadchat-a4cce1023cae299a808875c00d6427003145da7d.tar.gz
chat-a4cce1023cae299a808875c00d6427003145da7d.tar.bz2
chat-a4cce1023cae299a808875c00d6427003145da7d.zip
Merge pull request #2113 from mattermost/slash-command-fixes
Multiple minor slash command fixes
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/async_client.jsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index d5fc10b8f..c8676f45d 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -779,13 +779,19 @@ export function getSuggestedCommands(command, suggestionId, component) {
var matches = [];
data.forEach((cmd) => {
if (('/' + cmd.trigger).indexOf(command) === 0) {
+ let s = '/' + cmd.trigger;
+ if (cmd.auto_complete_hint && cmd.auto_complete_hint.length !== 0) {
+ s += ' ' + cmd.auto_complete_hint;
+ }
matches.push({
- suggestion: '/' + cmd.trigger + ' ' + cmd.auto_complete_hint,
+ suggestion: s,
description: cmd.auto_complete_desc
});
}
});
+ matches = matches.sort((a, b) => a.suggestion.localeCompare(b.suggestion));
+
// pull out the suggested commands from the returned data
const terms = matches.map((suggestion) => suggestion.suggestion);