summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2016-02-09 09:16:08 -0500
committerJoramWilander <jwawilander@gmail.com>2016-02-09 09:16:08 -0500
commit8ac0e800f18167b711cacbdaa91c5013decb79bf (patch)
tree1842aa08c71c2c9517b1bee3b622aa145eb84b82
parent8e1c9c371b9fbfbc15d96d6f5c4092968dc41f43 (diff)
downloadchat-8ac0e800f18167b711cacbdaa91c5013decb79bf.tar.gz
chat-8ac0e800f18167b711cacbdaa91c5013decb79bf.tar.bz2
chat-8ac0e800f18167b711cacbdaa91c5013decb79bf.zip
Multiple minor slash command fixes
-rw-r--r--web/react/components/user_settings/user_settings_modal.jsx2
-rw-r--r--web/react/utils/async_client.jsx8
2 files changed, 8 insertions, 2 deletions
diff --git a/web/react/components/user_settings/user_settings_modal.jsx b/web/react/components/user_settings/user_settings_modal.jsx
index e0b72157b..90f28822b 100644
--- a/web/react/components/user_settings/user_settings_modal.jsx
+++ b/web/react/components/user_settings/user_settings_modal.jsx
@@ -234,7 +234,7 @@ class UserSettingsModal extends React.Component {
tabs.push({name: 'developer', uiName: formatMessage(holders.developer), icon: 'glyphicon glyphicon-th'});
}
- if (global.window.mm_config.EnableIncomingWebhooks === 'true' || global.window.mm_config.EnableOutgoingWebhooks === 'true') {
+ if (global.window.mm_config.EnableIncomingWebhooks === 'true' || global.window.mm_config.EnableOutgoingWebhooks === 'true' || global.window.mm_config.EnableCommands === 'true') {
tabs.push({name: 'integrations', uiName: formatMessage(holders.integrations), icon: 'glyphicon glyphicon-transfer'});
}
tabs.push({name: 'display', uiName: formatMessage(holders.display), icon: 'glyphicon glyphicon-eye-open'});
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);