diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-03-29 10:53:09 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-03-29 15:18:48 -0400 |
commit | 4029db3905de46e00face17e3d05d03abb1f433a (patch) | |
tree | 0cd9815629d100754837c1568e23625c1c4a7857 /webapp | |
parent | 17f10b1abad76d797e7c0b3b686f065a253f5c0b (diff) | |
download | chat-4029db3905de46e00face17e3d05d03abb1f433a.tar.gz chat-4029db3905de46e00face17e3d05d03abb1f433a.tar.bz2 chat-4029db3905de46e00face17e3d05d03abb1f433a.zip |
Fixed hardcoded team name in InstalledIntegrations
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/components/backstage/installed_integrations.jsx | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/webapp/components/backstage/installed_integrations.jsx b/webapp/components/backstage/installed_integrations.jsx index 0b6701b21..45f289df4 100644 --- a/webapp/components/backstage/installed_integrations.jsx +++ b/webapp/components/backstage/installed_integrations.jsx @@ -6,6 +6,7 @@ import React from 'react'; import * as AsyncClient from 'utils/async_client.jsx'; import ChannelStore from 'stores/channel_store.jsx'; import IntegrationStore from 'stores/integration_store.jsx'; +import TeamStore from 'stores/team_store.jsx'; import * as Utils from 'utils/utils.jsx'; import {FormattedMessage} from 'react-intl'; @@ -17,7 +18,8 @@ export default class InstalledIntegrations extends React.Component { constructor(props) { super(props); - this.handleChange = this.handleChange.bind(this); + this.handleIntegrationChange = this.handleIntegrationChange.bind(this); + this.handleTeamChange = this.handleTeamChange.bind(this); this.updateFilter = this.updateFilter.bind(this); this.updateTypeFilter = this.updateTypeFilter.bind(this); @@ -26,6 +28,7 @@ export default class InstalledIntegrations extends React.Component { this.deleteOutgoingWebhook = this.deleteOutgoingWebhook.bind(this); this.state = { + team: TeamStore.getCurrent(), incomingWebhooks: [], outgoingWebhooks: [], typeFilter: '', @@ -34,7 +37,8 @@ export default class InstalledIntegrations extends React.Component { } componentWillMount() { - IntegrationStore.addChangeListener(this.handleChange); + IntegrationStore.addChangeListener(this.handleIntegrationChange); + TeamStore.addChangeListener(this.handleTeamChange); if (window.mm_config.EnableIncomingWebhooks === 'true') { if (IntegrationStore.hasReceivedIncomingWebhooks()) { @@ -58,16 +62,23 @@ export default class InstalledIntegrations extends React.Component { } componentWillUnmount() { - IntegrationStore.removeChangeListener(this.handleChange); + IntegrationStore.removeChangeListener(this.handleIntegrationChange); + TeamStore.removeChangeListener(this.handleTeamChange); } - handleChange() { + handleIntegrationChange() { this.setState({ incomingWebhooks: IntegrationStore.getIncomingWebhooks(), outgoingWebhooks: IntegrationStore.getOutgoingWebhooks() }); } + handleTeamChange() { + this.setState({ + team: TeamStore.getCurrent() + }); + } + updateTypeFilter(e, typeFilter) { e.preventDefault(); @@ -195,6 +206,10 @@ export default class InstalledIntegrations extends React.Component { } render() { + if (!this.state.team) { + return null; + } + const incomingWebhooks = this.state.incomingWebhooks; const outgoingWebhooks = this.state.outgoingWebhooks; @@ -254,7 +269,7 @@ export default class InstalledIntegrations extends React.Component { </h1> <Link className='add-integrations-link' - to={'/yourteamhere/integrations/add'} + to={`/${this.state.team.name}/integrations/add`} > <button type='button' |