// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import * as AsyncClient from '../utils/async_client.jsx'; import * as Client from '../utils/client.jsx'; const Modal = ReactBootstrap.Modal; import TeamStore from '../stores/team_store.jsx'; import * as Utils from '../utils/utils.jsx'; export default class DeleteChannelModal extends React.Component { constructor(props) { super(props); this.handleDelete = this.handleDelete.bind(this); } handleDelete() { if (this.props.channel.id.length !== 26) { return; } Client.deleteChannel( this.props.channel.id, () => { AsyncClient.getChannels(true); window.location.href = TeamStore.getCurrentTeamUrl() + '/channels/town-square'; }, (err) => { AsyncClient.dispatchError(err, 'handleDelete'); } ); } render() { const channelTerm = Utils.getChannelTerm(this.props.channel.type).toLowerCase(); return (

{'Confirm DELETE Channel'}

{`Are you sure you wish to delete the ${this.props.channel.display_name} ${channelTerm}?`}
); } } DeleteChannelModal.propTypes = { show: React.PropTypes.bool.isRequired, onHide: React.PropTypes.func.isRequired, channel: React.PropTypes.object.isRequired };