diff options
Diffstat (limited to 'webapp/components')
-rw-r--r-- | webapp/components/admin_console/admin_sidebar.jsx | 10 | ||||
-rw-r--r-- | webapp/components/admin_console/custom_emoji_settings.jsx | 91 |
2 files changed, 101 insertions, 0 deletions
diff --git a/webapp/components/admin_console/admin_sidebar.jsx b/webapp/components/admin_console/admin_sidebar.jsx index c947be5cb..28769d484 100644 --- a/webapp/components/admin_console/admin_sidebar.jsx +++ b/webapp/components/admin_console/admin_sidebar.jsx @@ -533,6 +533,16 @@ export default class AdminSidebar extends React.Component { > {customBranding} <AdminSidebarSection + name='custom_emoji' + title={ + <FormattedMessage + id='admin.sidebar.customEmoji' + defaultMessage='Custom Emoji' + /> + + } + /> + <AdminSidebarSection name='legal_and_support' title={ <FormattedMessage diff --git a/webapp/components/admin_console/custom_emoji_settings.jsx b/webapp/components/admin_console/custom_emoji_settings.jsx new file mode 100644 index 000000000..332c7b216 --- /dev/null +++ b/webapp/components/admin_console/custom_emoji_settings.jsx @@ -0,0 +1,91 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React from 'react'; + +import * as Utils from 'utils/utils.jsx'; + +import AdminSettings from './admin_settings.jsx'; +import BooleanSetting from './boolean_setting.jsx'; +import DropdownSetting from './dropdown_setting.jsx'; +import {FormattedMessage} from 'react-intl'; +import SettingsGroup from './settings_group.jsx'; + +export default class CustomEmojiSettings extends AdminSettings { + constructor(props) { + super(props); + + this.getConfigFromState = this.getConfigFromState.bind(this); + + this.renderSettings = this.renderSettings.bind(this); + + this.state = Object.assign(this.state, { + enableCustomEmoji: props.config.ServiceSettings.EnableCustomEmoji, + restrictCustomEmojiCreation: props.config.ServiceSettings.RestrictCustomEmojiCreation + }); + } + + getConfigFromState(config) { + config.ServiceSettings.EnableCustomEmoji = this.state.enableCustomEmoji; + config.ServiceSettings.RestrictCustomEmojiCreation = this.state.restrictCustomEmojiCreation; + + return config; + } + + renderTitle() { + return ( + <h3> + <FormattedMessage + id='admin.customization.customEmoji' + defaultMessage='Custom Emoji' + /> + </h3> + ); + } + + renderSettings() { + return ( + <SettingsGroup> + <BooleanSetting + id='enableCustomEmoji' + label={ + <FormattedMessage + id='admin.customization.enableCustomEmojiTitle' + defaultMessage='Enable Custom Emoji:' + /> + } + helpText={ + <FormattedMessage + id='admin.customization.enableCustomEmojiDesc' + defaultMessage='Enable users to create custom emoji for use in chat messages.' + /> + } + value={this.state.enableCustomEmoji} + onChange={this.handleChange} + /> + <DropdownSetting + id='restrictCustomEmojiCreation' + values={[ + {value: 'all', text: Utils.localizeMessage('admin.customization.restrictCustomEmojiCreationAll', 'Allow everyone to create custom emoji')}, + {value: 'system_admin', text: Utils.localizeMessage('admin.customization.restrictCustomEmojiCreationSystemAdmin', 'Only allow system admins to create custom emoji')} + ]} + label={ + <FormattedMessage + id='admin.customization.restrictCustomEmojiCreationTitle' + defaultMessage='Restrict Custom Emoji Creation:' + /> + } + helpText={ + <FormattedMessage + id='admin.customization.restrictCustomEmojiCreationDesc' + defaultMessage='Restrict the creation of custom emoji to certain users.' + /> + } + value={this.state.restrictCustomEmojiCreation} + onChange={this.handleChange} + disabled={!this.state.enableCustomEmoji} + /> + </SettingsGroup> + ); + } +}
\ No newline at end of file |