// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import React from 'react'; import TeamStore from 'stores/team_store.jsx'; import * as Utils from 'utils/utils.jsx'; import BackstageCategory from './backstage_category.jsx'; import BackstageSection from './backstage_section.jsx'; import {FormattedMessage} from 'react-intl'; export default class BackstageSidebar extends React.Component { static get propTypes() { return { team: React.PropTypes.object.isRequired, user: React.PropTypes.object.isRequired }; } renderCustomEmoji() { if (window.mm_config.EnableCustomEmoji !== 'true' || !Utils.canCreateCustomEmoji(this.props.user)) { return null; } return ( } /> ); } renderIntegrations() { const config = window.mm_config; const isSystemAdmin = Utils.isSystemAdmin(this.props.user.roles); if (config.EnableIncomingWebhooks !== 'true' && config.EnableOutgoingWebhooks !== 'true' && config.EnableCommands !== 'true' && config.EnableOAuthServiceProvider !== 'true') { return null; } if (config.EnableOnlyAdminIntegrations !== 'false' && !isSystemAdmin && !TeamStore.isTeamAdmin(this.props.user.id, this.props.team.id)) { return null; } let incomingWebhooks = null; if (config.EnableIncomingWebhooks === 'true') { incomingWebhooks = ( )} /> ); } let outgoingWebhooks = null; if (config.EnableOutgoingWebhooks === 'true') { outgoingWebhooks = ( )} /> ); } let commands = null; if (config.EnableCommands === 'true') { commands = ( )} /> ); } let oauthApps = null; if (config.EnableOAuthServiceProvider === 'true' && (isSystemAdmin || config.EnableOnlyAdminIntegrations !== 'true')) { oauthApps = ( } /> ); } return ( } > {incomingWebhooks} {outgoingWebhooks} {commands} {oauthApps} ); } render() { return (
    {this.renderCustomEmoji()} {this.renderIntegrations()}
); } }