In webhooks UI handle error if channel can't be found, also use display name over url name, plus warning fixes
Этот коммит содержится в:
@@ -96,7 +96,14 @@ export default class ManageIncomingHooks extends React.Component {
|
|||||||
const options = [];
|
const options = [];
|
||||||
channels.forEach((channel) => {
|
channels.forEach((channel) => {
|
||||||
if (channel.type !== Constants.DM_CHANNEL) {
|
if (channel.type !== Constants.DM_CHANNEL) {
|
||||||
options.push(<option value={channel.id}>{channel.name}</option>);
|
options.push(
|
||||||
|
<option
|
||||||
|
key={'incoming-hook' + channel.id}
|
||||||
|
value={channel.id}
|
||||||
|
>
|
||||||
|
{channel.display_name}
|
||||||
|
</option>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -108,26 +115,31 @@ export default class ManageIncomingHooks extends React.Component {
|
|||||||
const hooks = [];
|
const hooks = [];
|
||||||
this.state.hooks.forEach((hook) => {
|
this.state.hooks.forEach((hook) => {
|
||||||
const c = ChannelStore.get(hook.channel_id);
|
const c = ChannelStore.get(hook.channel_id);
|
||||||
hooks.push(
|
if (c) {
|
||||||
<div className='font--small'>
|
hooks.push(
|
||||||
<div className='padding-top x2 divider-light'></div>
|
<div
|
||||||
<div className='padding-top x2'>
|
key={hook.id}
|
||||||
<strong>{'URL: '}</strong><span className='word-break--all'>{Utils.getWindowLocationOrigin() + '/hooks/' + hook.id}</span>
|
className='font--small'
|
||||||
|
>
|
||||||
|
<div className='padding-top x2 divider-light'></div>
|
||||||
|
<div className='padding-top x2'>
|
||||||
|
<strong>{'URL: '}</strong><span className='word-break--all'>{Utils.getWindowLocationOrigin() + '/hooks/' + hook.id}</span>
|
||||||
|
</div>
|
||||||
|
<div className='padding-top'>
|
||||||
|
<strong>{'Channel: '}</strong>{c.display_name}
|
||||||
|
</div>
|
||||||
|
<div className='padding-top'>
|
||||||
|
<a
|
||||||
|
className={'text-danger'}
|
||||||
|
href='#'
|
||||||
|
onClick={this.removeHook.bind(this, hook.id)}
|
||||||
|
>
|
||||||
|
{'Remove'}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='padding-top'>
|
);
|
||||||
<strong>{'Channel: '}</strong>{c.name}
|
}
|
||||||
</div>
|
|
||||||
<div className='padding-top'>
|
|
||||||
<a
|
|
||||||
className={'text-danger'}
|
|
||||||
href='#'
|
|
||||||
onClick={this.removeHook.bind(this, hook.id)}
|
|
||||||
>
|
|
||||||
{'Remove'}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let displayHooks;
|
let displayHooks;
|
||||||
|
|||||||
@@ -128,21 +128,42 @@ export default class ManageOutgoingHooks extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const channels = ChannelStore.getAll();
|
const channels = ChannelStore.getAll();
|
||||||
const options = [<option value=''>{'--- Select a channel ---'}</option>];
|
const options = [];
|
||||||
|
options.push(
|
||||||
|
<option
|
||||||
|
key='select-channel'
|
||||||
|
value=''
|
||||||
|
>
|
||||||
|
{'--- Select a channel ---'}
|
||||||
|
</option>
|
||||||
|
);
|
||||||
|
|
||||||
channels.forEach((channel) => {
|
channels.forEach((channel) => {
|
||||||
if (channel.type === Constants.OPEN_CHANNEL) {
|
if (channel.type === Constants.OPEN_CHANNEL) {
|
||||||
options.push(<option value={channel.id}>{channel.name}</option>);
|
options.push(
|
||||||
|
<option
|
||||||
|
key={'outgoing-hook' + channel.id}
|
||||||
|
value={channel.id}
|
||||||
|
>
|
||||||
|
{channel.display_name}
|
||||||
|
</option>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const hooks = [];
|
const hooks = [];
|
||||||
this.state.hooks.forEach((hook) => {
|
this.state.hooks.forEach((hook) => {
|
||||||
const c = ChannelStore.get(hook.channel_id);
|
const c = ChannelStore.get(hook.channel_id);
|
||||||
|
|
||||||
|
if (!c && hook.channel_id && hook.channel_id.length !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let channelDiv;
|
let channelDiv;
|
||||||
if (c) {
|
if (c) {
|
||||||
channelDiv = (
|
channelDiv = (
|
||||||
<div className='padding-top'>
|
<div className='padding-top'>
|
||||||
<strong>{'Channel: '}</strong>{c.name}
|
<strong>{'Channel: '}</strong>{c.display_name}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -157,7 +178,10 @@ export default class ManageOutgoingHooks extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hooks.push(
|
hooks.push(
|
||||||
<div className='font--small'>
|
<div
|
||||||
|
key={hook.id}
|
||||||
|
className='font--small'
|
||||||
|
>
|
||||||
<div className='padding-top x2 divider-light'></div>
|
<div className='padding-top x2 divider-light'></div>
|
||||||
<div className='padding-top x2'>
|
<div className='padding-top x2'>
|
||||||
<strong>{'URLs: '}</strong><span className='word-break--all'>{hook.callback_urls.join(', ')}</span>
|
<strong>{'URLs: '}</strong><span className='word-break--all'>{hook.callback_urls.join(', ')}</span>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export default class UserSettingsIntegrationsTab extends React.Component {
|
|||||||
if (global.window.config.EnableIncomingWebhooks === 'true') {
|
if (global.window.config.EnableIncomingWebhooks === 'true') {
|
||||||
if (this.props.activeSection === 'incoming-hooks') {
|
if (this.props.activeSection === 'incoming-hooks') {
|
||||||
inputs.push(
|
inputs.push(
|
||||||
<ManageIncomingHooks />
|
<ManageIncomingHooks key='incoming-hook-ui' />
|
||||||
);
|
);
|
||||||
|
|
||||||
incomingHooksSection = (
|
incomingHooksSection = (
|
||||||
@@ -68,7 +68,7 @@ export default class UserSettingsIntegrationsTab extends React.Component {
|
|||||||
if (global.window.config.EnableOutgoingWebhooks === 'true') {
|
if (global.window.config.EnableOutgoingWebhooks === 'true') {
|
||||||
if (this.props.activeSection === 'outgoing-hooks') {
|
if (this.props.activeSection === 'outgoing-hooks') {
|
||||||
inputs.push(
|
inputs.push(
|
||||||
<ManageOutgoingHooks />
|
<ManageOutgoingHooks key='outgoing-hook-ui' />
|
||||||
);
|
);
|
||||||
|
|
||||||
outgoingHooksSection = (
|
outgoingHooksSection = (
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user