Unverified Commit bcc32d40 authored by George Goldberg's avatar George Goldberg Committed by GitHub
Browse files

MM-10352: Enable locking incoming webhooks to a single channel. (#1237)

* MM-10352: Enable locking incoming webhooks to a single channel.

* Update text.
parent ba36592d
......@@ -66,6 +66,7 @@ export default class AbstractIncomingWebhook extends React.Component {
displayName: hook.display_name || '',
description: hook.description || '',
channelId: hook.channel_id || '',
channelLocked: hook.channel_locked || false,
username: hook.username || '',
iconURL: hook.icon_url || '',
saving: false,
......@@ -103,6 +104,7 @@ export default class AbstractIncomingWebhook extends React.Component {
const hook = {
channel_id: this.state.channelId,
channel_locked: this.state.channelLocked,
display_name: this.state.displayName,
description: this.state.description,
username: this.state.username,
......@@ -130,6 +132,12 @@ export default class AbstractIncomingWebhook extends React.Component {
});
}
updateChannelLocked = (e) => {
this.setState({
channelLocked: e.target.checked,
});
}
updateUsername = (e) => {
this.setState({
username: e.target.value,
......@@ -245,6 +253,31 @@ export default class AbstractIncomingWebhook extends React.Component {
</div>
</div>
</div>
<div className='form-group'>
<label
className='control-label col-sm-4'
htmlFor='channelLocked'
>
<FormattedMessage
id='add_incoming_webhook.channelLocked'
defaultMessage='Lock to this channel'
/>
</label>
<div className='col-md-5 col-sm-8 checkbox'>
<input
id='channelLocked'
type='checkbox'
checked={this.state.channelLocked}
onChange={this.updateChannelLocked}
/>
<div className='form__help'>
<FormattedMessage
id='add_incoming_webhook.channelLocked.help'
defaultMessage='If set, the incoming webhook can only post to the channel selected above.'
/>
</div>
</div>
</div>
{ this.props.enablePostUsernameOverride &&
<div className='form-group'>
<label
......
......@@ -106,6 +106,8 @@
"add_incoming_webhook.url": "<b>URL</b>: {url}",
"add_incoming_webhook.username": "Username",
"add_incoming_webhook.username.help": "Choose the username this integration will post as. Usernames can be up to 22 characters, and may contain lowercase letters, numbers and the symbols \"-\", \"_\", and \".\" .",
"add_incoming_webhook.channelLocked": "Lock to this channel",
"add_incoming_webhook.channelLocked.help": "If set, the incoming webhook can only post to the channel selected above.",
"add_oauth_app.callbackUrls.help": "The redirect URIs to which the service will redirect users after accepting or denying authorization of your application, and which will handle authorization codes or access tokens. Must be a valid URL and start with http:// or https://.",
"add_oauth_app.callbackUrlsRequired": "One or more callback URLs are required",
"add_oauth_app.clientId": "<b>Client ID</b>: {id}",
......
......@@ -133,6 +133,39 @@ exports[`components/integrations/AbstractIncomingWebhook should call action func
</div>
</div>
</div>
<div
className="form-group"
>
<label
className="control-label col-sm-4"
htmlFor="channelLocked"
>
<FormattedMessage
defaultMessage="Lock to this channel"
id="add_incoming_webhook.channelLocked"
values={Object {}}
/>
</label>
<div
className="col-md-5 col-sm-8 checkbox"
>
<input
checked={false}
id="channelLocked"
onChange={[Function]}
type="checkbox"
/>
<div
className="form__help"
>
<FormattedMessage
defaultMessage="If set, the incoming webhook can only post to the channel selected above."
id="add_incoming_webhook.channelLocked.help"
values={Object {}}
/>
</div>
</div>
</div>
<div
className="form-group"
>
......@@ -378,6 +411,39 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot 1
</div>
</div>
</div>
<div
className="form-group"
>
<label
className="control-label col-sm-4"
htmlFor="channelLocked"
>
<FormattedMessage
defaultMessage="Lock to this channel"
id="add_incoming_webhook.channelLocked"
values={Object {}}
/>
</label>
<div
className="col-md-5 col-sm-8 checkbox"
>
<input
checked={false}
id="channelLocked"
onChange={[Function]}
type="checkbox"
/>
<div
className="form__help"
>
<FormattedMessage
defaultMessage="If set, the incoming webhook can only post to the channel selected above."
id="add_incoming_webhook.channelLocked.help"
values={Object {}}
/>
</div>
</div>
</div>
<div
className="form-group"
>
......@@ -623,6 +689,39 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
</div>
</div>
</div>
<div
className="form-group"
>
<label
className="control-label col-sm-4"
htmlFor="channelLocked"
>
<FormattedMessage
defaultMessage="Lock to this channel"
id="add_incoming_webhook.channelLocked"
values={Object {}}
/>
</label>
<div
className="col-md-5 col-sm-8 checkbox"
>
<input
checked={false}
id="channelLocked"
onChange={[Function]}
type="checkbox"
/>
<div
className="form__help"
>
<FormattedMessage
defaultMessage="If set, the incoming webhook can only post to the channel selected above."
id="add_incoming_webhook.channelLocked.help"
values={Object {}}
/>
</div>
</div>
</div>
<div
className="form-group"
>
......@@ -872,6 +971,39 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
</div>
</div>
</div>
<div
className="form-group"
>
<label
className="control-label col-sm-4"
htmlFor="channelLocked"
>
<FormattedMessage
defaultMessage="Lock to this channel"
id="add_incoming_webhook.channelLocked"
values={Object {}}
/>
</label>
<div
className="col-md-5 col-sm-8 checkbox"
>
<input
checked={false}
id="channelLocked"
onChange={[Function]}
type="checkbox"
/>
<div
className="form__help"
>
<FormattedMessage
defaultMessage="If set, the incoming webhook can only post to the channel selected above."
id="add_incoming_webhook.channelLocked.help"
values={Object {}}
/>
</div>
</div>
</div>
<div
className="form-group"
>
......@@ -1082,6 +1214,39 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
</div>
</div>
</div>
<div
className="form-group"
>
<label
className="control-label col-sm-4"
htmlFor="channelLocked"
>
<FormattedMessage
defaultMessage="Lock to this channel"
id="add_incoming_webhook.channelLocked"
values={Object {}}
/>
</label>
<div
className="col-md-5 col-sm-8 checkbox"
>
<input
checked={false}
id="channelLocked"
onChange={[Function]}
type="checkbox"
/>
<div
className="form__help"
>
<FormattedMessage
defaultMessage="If set, the incoming webhook can only post to the channel selected above."
id="add_incoming_webhook.channelLocked.help"
values={Object {}}
/>
</div>
</div>
</div>
<div
className="form-group"
>
......@@ -1292,6 +1457,39 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
</div>
</div>
</div>
<div
className="form-group"
>
<label
className="control-label col-sm-4"
htmlFor="channelLocked"
>
<FormattedMessage
defaultMessage="Lock to this channel"
id="add_incoming_webhook.channelLocked"
values={Object {}}
/>
</label>
<div
className="col-md-5 col-sm-8 checkbox"
>
<input
checked={false}
id="channelLocked"
onChange={[Function]}
type="checkbox"
/>
<div
className="form__help"
>
<FormattedMessage
defaultMessage="If set, the incoming webhook can only post to the channel selected above."
id="add_incoming_webhook.channelLocked.help"
values={Object {}}
/>
</div>
</div>
</div>
<div
className="form-group"
>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment