summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-03-30 10:56:20 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2016-04-04 09:45:02 -0400
commit441156b91e9f9bac6b5592616551e2920c4cb33b (patch)
tree64e0c2e8a1329a0b761883fd47c3b588d11a69af /webapp
parent785553384fe96027b0e9274b6ccc8623092eda70 (diff)
downloadchat-441156b91e9f9bac6b5592616551e2920c4cb33b.tar.gz
chat-441156b91e9f9bac6b5592616551e2920c4cb33b.tar.bz2
chat-441156b91e9f9bac6b5592616551e2920c4cb33b.zip
Added DisplayName and Description fields to both types of webhooks and slash commands
Diffstat (limited to 'webapp')
-rw-r--r--webapp/components/backstage/add_incoming_webhook.jsx24
-rw-r--r--webapp/components/backstage/add_outgoing_webhook.jsx24
-rw-r--r--webapp/components/backstage/installed_incoming_webhook.jsx5
-rw-r--r--webapp/components/backstage/installed_outgoing_webhook.jsx5
4 files changed, 30 insertions, 28 deletions
diff --git a/webapp/components/backstage/add_incoming_webhook.jsx b/webapp/components/backstage/add_incoming_webhook.jsx
index 83027c6b3..afeb9d569 100644
--- a/webapp/components/backstage/add_incoming_webhook.jsx
+++ b/webapp/components/backstage/add_incoming_webhook.jsx
@@ -18,12 +18,12 @@ export default class AddIncomingWebhook extends React.Component {
this.handleSubmit = this.handleSubmit.bind(this);
- this.updateName = this.updateName.bind(this);
+ this.updateDisplayName = this.updateDisplayName.bind(this);
this.updateDescription = this.updateDescription.bind(this);
this.updateChannelId = this.updateChannelId.bind(this);
this.state = {
- name: '',
+ displayName: '',
description: '',
channelId: '',
saving: false,
@@ -60,7 +60,9 @@ export default class AddIncomingWebhook extends React.Component {
}
const hook = {
- channel_id: this.state.channelId
+ channel_id: this.state.channelId,
+ display_name: this.state.displayName,
+ description: this.state.description
};
AsyncClient.addIncomingHook(
@@ -76,9 +78,9 @@ export default class AddIncomingWebhook extends React.Component {
);
}
- updateName(e) {
+ updateDisplayName(e) {
this.setState({
- name: e.target.value
+ displayName: e.target.value
});
}
@@ -112,20 +114,20 @@ export default class AddIncomingWebhook extends React.Component {
<div className='form-group'>
<label
className='control-label col-sm-3'
- htmlFor='name'
+ htmlFor='displayName'
>
<FormattedMessage
- id='add_incoming_webhook.name'
- defaultMessage='Name'
+ id='add_incoming_webhook.displayName'
+ defaultMessage='Display Name'
/>
</label>
<div className='col-md-5 col-sm-9'>
<input
- id='name'
+ id='displayName'
type='text'
className='form-control'
- value={this.state.name}
- onChange={this.updateName}
+ value={this.state.displayName}
+ onChange={this.updateDisplayName}
/>
</div>
</div>
diff --git a/webapp/components/backstage/add_outgoing_webhook.jsx b/webapp/components/backstage/add_outgoing_webhook.jsx
index 5d98138df..c2b5e0414 100644
--- a/webapp/components/backstage/add_outgoing_webhook.jsx
+++ b/webapp/components/backstage/add_outgoing_webhook.jsx
@@ -18,14 +18,14 @@ export default class AddOutgoingWebhook extends React.Component {
this.handleSubmit = this.handleSubmit.bind(this);
- this.updateName = this.updateName.bind(this);
+ this.updateDisplayName = this.updateDisplayName.bind(this);
this.updateDescription = this.updateDescription.bind(this);
this.updateChannelId = this.updateChannelId.bind(this);
this.updateTriggerWords = this.updateTriggerWords.bind(this);
this.updateCallbackUrls = this.updateCallbackUrls.bind(this);
this.state = {
- name: '',
+ displayName: '',
description: '',
channelId: '',
triggerWords: '',
@@ -80,7 +80,9 @@ export default class AddOutgoingWebhook extends React.Component {
const hook = {
channel_id: this.state.channelId,
trigger_words: this.state.triggerWords.split('\n').map((word) => word.trim()),
- callback_urls: this.state.callbackUrls.split('\n').map((url) => url.trim())
+ callback_urls: this.state.callbackUrls.split('\n').map((url) => url.trim()),
+ display_name: this.state.displayName,
+ description: this.state.description
};
AsyncClient.addOutgoingHook(
@@ -96,9 +98,9 @@ export default class AddOutgoingWebhook extends React.Component {
);
}
- updateName(e) {
+ updateDisplayName(e) {
this.setState({
- name: e.target.value
+ displayName: e.target.value
});
}
@@ -144,20 +146,20 @@ export default class AddOutgoingWebhook extends React.Component {
<div className='form-group'>
<label
className='control-label col-sm-3'
- htmlFor='name'
+ htmlFor='displayName'
>
<FormattedMessage
- id='add_outgoing_webhook.name'
- defaultMessage='Name'
+ id='add_outgoing_webhook.displayName'
+ defaultMessage='Display Name'
/>
</label>
<div className='col-md-5 col-sm-9'>
<input
- id='name'
+ id='displayName'
type='text'
className='form-control'
- value={this.state.name}
- onChange={this.updateName}
+ value={this.state.displayName}
+ onChange={this.updateDisplayName}
/>
</div>
</div>
diff --git a/webapp/components/backstage/installed_incoming_webhook.jsx b/webapp/components/backstage/installed_incoming_webhook.jsx
index f65cf6327..262bfe21d 100644
--- a/webapp/components/backstage/installed_incoming_webhook.jsx
+++ b/webapp/components/backstage/installed_incoming_webhook.jsx
@@ -4,7 +4,6 @@
import React from 'react';
import ChannelStore from 'stores/channel_store.jsx';
-import * as Utils from 'utils/utils.jsx';
import {FormattedMessage} from 'react-intl';
@@ -39,7 +38,7 @@ export default class InstalledIncomingWebhook extends React.Component {
<div className='item-details'>
<div className='item-details__row'>
<span className='item-details__name'>
- {channelName}
+ {incomingWebhook.display_name || channelName}
</span>
<span className='item-details__type'>
<FormattedMessage
@@ -50,7 +49,7 @@ export default class InstalledIncomingWebhook extends React.Component {
</div>
<div className='item-details__row'>
<span className='item-details__description'>
- {Utils.getWindowLocationOrigin() + '/hooks/' + incomingWebhook.id}
+ {incomingWebhook.description}
</span>
</div>
</div>
diff --git a/webapp/components/backstage/installed_outgoing_webhook.jsx b/webapp/components/backstage/installed_outgoing_webhook.jsx
index fee427260..4482029bf 100644
--- a/webapp/components/backstage/installed_outgoing_webhook.jsx
+++ b/webapp/components/backstage/installed_outgoing_webhook.jsx
@@ -4,7 +4,6 @@
import React from 'react';
import ChannelStore from 'stores/channel_store.jsx';
-import * as Utils from 'utils/utils.jsx';
import {FormattedMessage} from 'react-intl';
@@ -47,7 +46,7 @@ export default class InstalledOutgoingWebhook extends React.Component {
<div className='item-details'>
<div className='item-details__row'>
<span className='item-details__name'>
- {channelName}
+ {outgoingWebhook.display_name || channelName}
</span>
<span className='item-details__type'>
<FormattedMessage
@@ -58,7 +57,7 @@ export default class InstalledOutgoingWebhook extends React.Component {
</div>
<div className='item-details__row'>
<span className='item-details__description'>
- {Utils.getWindowLocationOrigin() + '/hooks/' + outgoingWebhook.id}
+ {outgoingWebhook.description}
{' - '}
{outgoingWebhook.token}
</span>