<commit_before>// 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 (
            <BackstageCategory
                name='emoji'
                parentLink={'/' + this.props.team.name}
                icon='fa-smile-o'
                title={
                    <FormattedMessage
                        id='backstage_sidebar.emoji'
                        defaultMessage='Custom Emoji'
                    />
                }
            />
        );
    }

    renderIntegrations() {
        if (window.mm_config.EnableIncomingWebhooks !== 'true' &&
            window.mm_config.EnableOutgoingWebhooks !== 'true' &&
            window.mm_config.EnableCommands !== 'true') {
            return null;
        }

        if (window.mm_config.EnableOnlyAdminIntegrations !== 'false' && !TeamStore.isTeamAdmin(this.props.user.id, this.props.team.id)) {<commit_msg>Always allow system admins to see the Integrations sidebar (#3536)<commit_after>// 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 (
            <BackstageCategory
                name='emoji'
                parentLink={'/' + this.props.team.name}
                icon='fa-smile-o'
                title={
                    <FormattedMessage
                        id='backstage_sidebar.emoji'
                        defaultMessage='Custom Emoji'
                    />
                }
            />
        );
    }

    renderIntegrations() {
        if (window.mm_config.EnableIncomingWebhooks !== 'true' &&
            window.mm_config.EnableOutgoingWebhooks !== 'true' &&
            window.mm_config.EnableCommands !== 'true') {
            return null;
        }

        if (window.mm_config.EnableOnlyAdminIntegrations !== 'false' &&
            !Utils.isSystemAdmin(this.props.user.roles) &&
            !TeamStore.isTeamAdmin(this.props.user.id, this.props.team.id)) {
{'fraction_non_alphanumeric': 0.11157517899761336, 'fraction_numerical': 0.003579952267303103, 'mean_word_length': 2.026173285198556, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1086197', 'n_tokens_mistral': 937, 'n_tokens_neox': 910, 'n_words': 182}