// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import React from 'react'; import * as Utils from 'utils/utils.jsx'; import Constants from 'utils/constants.jsx'; import AdminSettings from './admin_settings.jsx'; import BooleanSetting from './boolean_setting.jsx'; import DropdownSetting from './dropdown_setting.jsx'; import {FormattedHTMLMessage, FormattedMessage} from 'react-intl'; import SettingsGroup from './settings_group.jsx'; import TextSetting from './text_setting.jsx'; const RESTRICT_DIRECT_MESSAGE_ANY = 'any'; const RESTRICT_DIRECT_MESSAGE_TEAM = 'team'; export default class UsersAndTeamsSettings extends AdminSettings { constructor(props) { super(props); this.getConfigFromState = this.getConfigFromState.bind(this); this.renderSettings = this.renderSettings.bind(this); } getConfigFromState(config) { config.TeamSettings.EnableUserCreation = this.state.enableUserCreation; config.TeamSettings.EnableTeamCreation = this.state.enableTeamCreation; config.TeamSettings.MaxUsersPerTeam = this.parseIntNonZero(this.state.maxUsersPerTeam, Constants.DEFAULT_MAX_USERS_PER_TEAM); config.TeamSettings.RestrictCreationToDomains = this.state.restrictCreationToDomains; config.TeamSettings.RestrictDirectMessage = this.state.restrictDirectMessage; config.TeamSettings.MaxChannelsPerTeam = this.parseIntNonZero(this.state.maxChannelsPerTeam, Constants.DEFAULT_MAX_CHANNELS_PER_TEAM); config.TeamSettings.MaxNotificationsPerChannel = this.parseIntNonZero(this.state.maxNotificationsPerChannel, Constants.DEFAULT_MAX_NOTIFICATIONS_PER_CHANNEL); return config; } getStateFromConfig(config) { return { enableUserCreation: config.TeamSettings.EnableUserCreation, enableTeamCreation: config.TeamSettings.EnableTeamCreation, maxUsersPerTeam: config.TeamSettings.MaxUsersPerTeam, restrictCreationToDomains: config.TeamSettings.RestrictCreationToDomains, restrictDirectMessage: config.TeamSettings.RestrictDirectMessage, maxChannelsPerTeam: config.TeamSettings.MaxChannelsPerTeam, maxNotificationsPerChannel: config.TeamSettings.MaxNotificationsPerChannel }; } renderTitle() { return (