Merge pull request #2113 from mattermost/slash-command-fixes

Multiple minor slash command fixes
This commit is contained in:
Christopher Speller
2016-02-09 11:24:14 -05:00
2 changed files with 8 additions and 2 deletions

View File

@@ -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'});

View File

@@ -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);