From 5e2596598f97e318f1e4e8bd835b08a011fa0b60 Mon Sep 17 00:00:00 2001 From: Nicolas Clerc Date: Mon, 15 Feb 2016 09:11:35 +0100 Subject: add external slashcommands management --- webapp/components/suggestion/command_provider.jsx | 4 +- webapp/components/suggestion/suggestion_box.jsx | 2 +- webapp/components/textbox.jsx | 1 + .../user_settings/manage_command_hooks.jsx | 43 +++++++++++++++++++++- webapp/utils/async_client.jsx | 9 +++-- webapp/utils/client.jsx | 5 ++- 6 files changed, 54 insertions(+), 10 deletions(-) (limited to 'webapp') diff --git a/webapp/components/suggestion/command_provider.jsx b/webapp/components/suggestion/command_provider.jsx index 36860fa66..204f52483 100644 --- a/webapp/components/suggestion/command_provider.jsx +++ b/webapp/components/suggestion/command_provider.jsx @@ -37,9 +37,9 @@ CommandSuggestion.propTypes = { }; export default class CommandProvider { - handlePretextChanged(suggestionId, pretext) { + handlePretextChanged(suggestionId, pretext, channelId) { if (pretext.startsWith('/')) { - AsyncClient.getSuggestedCommands(pretext, suggestionId, CommandSuggestion); + AsyncClient.getSuggestedCommands(pretext, channelId, suggestionId, CommandSuggestion); } } } diff --git a/webapp/components/suggestion/suggestion_box.jsx b/webapp/components/suggestion/suggestion_box.jsx index e3ec63194..04e4006f1 100644 --- a/webapp/components/suggestion/suggestion_box.jsx +++ b/webapp/components/suggestion/suggestion_box.jsx @@ -111,7 +111,7 @@ export default class SuggestionBox extends React.Component { handlePretextChanged(pretext) { for (const provider of this.props.providers) { - provider.handlePretextChanged(this.suggestionId, pretext); + provider.handlePretextChanged(this.suggestionId, pretext, this.props.channelId); } } diff --git a/webapp/components/textbox.jsx b/webapp/components/textbox.jsx index 1a395072e..952026ed5 100644 --- a/webapp/components/textbox.jsx +++ b/webapp/components/textbox.jsx @@ -224,6 +224,7 @@ export default class Textbox extends React.Component { style={{visibility: this.state.preview ? 'hidden' : 'visible'}} listComponent={SuggestionList} providers={this.suggestionProviders} + channelId={this.props.channelId} />
+
+ + + {cmd.external_management ? this.props.intl.formatMessage(holders.autocompleteYes) : this.props.intl.formatMessage(holders.autocompleteNo)} +
{triggerDiv}
@@ -416,7 +431,7 @@ export default class ManageCommandCmds extends React.Component {
); - const disableButton = this.state.cmd.trigger === '' || this.state.cmd.url === ''; + const disableButton = this.state.cmd.url === '' || (this.state.cmd.trigger === '' && !this.state.external_management); return (
@@ -433,6 +448,30 @@ export default class ManageCommandCmds extends React.Component {
+
+ +
+
+ +
+
+
+