fix JS error on SpinnerButton and refactor edit incoming/outgoing webhook (#6917)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b1322746d2
Коммит
d3506c9d69
@@ -31,13 +31,11 @@ export default class EditIncomingWebhook extends AbstractIncomingWebhook {
|
|||||||
handleIntegrationChange() {
|
handleIntegrationChange() {
|
||||||
const teamId = TeamStore.getCurrentId();
|
const teamId = TeamStore.getCurrentId();
|
||||||
|
|
||||||
this.setState({
|
const hooks = IntegrationStore.getIncomingWebhooks(teamId);
|
||||||
hooks: IntegrationStore.getIncomingWebhooks(teamId),
|
const loading = !IntegrationStore.hasReceivedIncomingWebhooks(teamId);
|
||||||
loading: !IntegrationStore.hasReceivedIncomingWebhooks(teamId)
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!this.state.loading) {
|
if (!loading) {
|
||||||
this.originalIncomingHook = this.state.hooks.filter((hook) => hook.id === this.props.location.query.id)[0];
|
this.originalIncomingHook = hooks.filter((hook) => hook.id === this.props.location.query.id)[0];
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
displayName: this.originalIncomingHook.display_name,
|
displayName: this.originalIncomingHook.display_name,
|
||||||
|
|||||||
@@ -43,21 +43,11 @@ export default class EditOutgoingWebhook extends AbstractOutgoingWebhook {
|
|||||||
handleIntegrationChange() {
|
handleIntegrationChange() {
|
||||||
const teamId = TeamStore.getCurrentId();
|
const teamId = TeamStore.getCurrentId();
|
||||||
|
|
||||||
this.setState({
|
const hooks = IntegrationStore.getOutgoingWebhooks(teamId);
|
||||||
hooks: IntegrationStore.getOutgoingWebhooks(teamId),
|
const loading = !IntegrationStore.hasReceivedOutgoingWebhooks(teamId);
|
||||||
loading: !IntegrationStore.hasReceivedOutgoingWebhooks(teamId)
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!this.state.loading) {
|
if (!loading) {
|
||||||
this.originalOutgoingHook = this.state.hooks.filter((hook) => hook.id === this.props.location.query.id)[0];
|
this.originalOutgoingHook = hooks.filter((hook) => hook.id === this.props.location.query.id)[0];
|
||||||
|
|
||||||
this.setState({
|
|
||||||
displayName: this.originalOutgoingHook.display_name,
|
|
||||||
description: this.originalOutgoingHook.description,
|
|
||||||
channelId: this.originalOutgoingHook.channel_id,
|
|
||||||
contentType: this.originalOutgoingHook.content_type,
|
|
||||||
triggerWhen: this.originalOutgoingHook.trigger_when
|
|
||||||
});
|
|
||||||
|
|
||||||
var triggerWords = '';
|
var triggerWords = '';
|
||||||
if (this.originalOutgoingHook.trigger_words) {
|
if (this.originalOutgoingHook.trigger_words) {
|
||||||
@@ -76,6 +66,11 @@ export default class EditOutgoingWebhook extends AbstractOutgoingWebhook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
|
displayName: this.originalOutgoingHook.display_name,
|
||||||
|
description: this.originalOutgoingHook.description,
|
||||||
|
channelId: this.originalOutgoingHook.channel_id,
|
||||||
|
contentType: this.originalOutgoingHook.content_type,
|
||||||
|
triggerWhen: this.originalOutgoingHook.trigger_when,
|
||||||
triggerWords,
|
triggerWords,
|
||||||
callbackUrls
|
callbackUrls
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,6 +16,12 @@ export default class SpinnerButton extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get defaultProps() {
|
||||||
|
return {
|
||||||
|
spinning: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {spinning, children, ...props} = this.props; // eslint-disable-line no-use-before-define
|
const {spinning, children, ...props} = this.props; // eslint-disable-line no-use-before-define
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user