mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fixed hardcoded team name in InstalledIntegrations
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user