From d8bd57901e33a7057e26e782e295099ffcc0da89 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 6 Sep 2017 23:04:13 -0700 Subject: Removing webapp --- webapp/components/admin_console/push_settings.jsx | 233 ---------------------- 1 file changed, 233 deletions(-) delete mode 100644 webapp/components/admin_console/push_settings.jsx (limited to 'webapp/components/admin_console/push_settings.jsx') diff --git a/webapp/components/admin_console/push_settings.jsx b/webapp/components/admin_console/push_settings.jsx deleted file mode 100644 index b5f788c86..000000000 --- a/webapp/components/admin_console/push_settings.jsx +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import React from 'react'; - -import Constants from 'utils/constants.jsx'; -import * as Utils from 'utils/utils.jsx'; - -import AdminSettings from './admin_settings.jsx'; -import DropdownSetting from './dropdown_setting.jsx'; -import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; -import SettingsGroup from './settings_group.jsx'; -import TextSetting from './text_setting.jsx'; - -const PUSH_NOTIFICATIONS_OFF = 'off'; -const PUSH_NOTIFICATIONS_MHPNS = 'mhpns'; -const PUSH_NOTIFICATIONS_MTPNS = 'mtpns'; -const PUSH_NOTIFICATIONS_CUSTOM = 'custom'; - -export default class PushSettings extends AdminSettings { - constructor(props) { - super(props); - - this.canSave = this.canSave.bind(this); - - this.handleAgreeChange = this.handleAgreeChange.bind(this); - - this.getConfigFromState = this.getConfigFromState.bind(this); - - this.renderSettings = this.renderSettings.bind(this); - } - - canSave() { - return this.state.pushNotificationServerType !== PUSH_NOTIFICATIONS_MHPNS || this.state.agree; - } - - handleAgreeChange(e) { - this.setState({ - agree: e.target.checked - }); - } - - handleChange(id, value) { - if (id === 'pushNotificationServerType') { - this.setState({ - agree: false - }); - - if (value === PUSH_NOTIFICATIONS_MHPNS) { - this.setState({ - pushNotificationServer: Constants.MHPNS - }); - } else if (value === PUSH_NOTIFICATIONS_MTPNS) { - this.setState({ - pushNotificationServer: Constants.MTPNS - }); - } - } - - super.handleChange(id, value); - } - - getConfigFromState(config) { - config.EmailSettings.SendPushNotifications = this.state.pushNotificationServerType !== PUSH_NOTIFICATIONS_OFF; - config.EmailSettings.PushNotificationServer = this.state.pushNotificationServer.trim(); - config.EmailSettings.PushNotificationContents = this.state.pushNotificationContents; - - return config; - } - - getStateFromConfig(config) { - let pushNotificationServerType = PUSH_NOTIFICATIONS_CUSTOM; - let agree = false; - if (!config.EmailSettings.SendPushNotifications) { - pushNotificationServerType = PUSH_NOTIFICATIONS_OFF; - } else if (config.EmailSettings.PushNotificationServer === Constants.MHPNS && - global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.MHPNS === 'true') { - pushNotificationServerType = PUSH_NOTIFICATIONS_MHPNS; - agree = true; - } else if (config.EmailSettings.PushNotificationServer === Constants.MTPNS) { - pushNotificationServerType = PUSH_NOTIFICATIONS_MTPNS; - } - - let pushNotificationServer = config.EmailSettings.PushNotificationServer; - if (pushNotificationServerType === PUSH_NOTIFICATIONS_MTPNS) { - pushNotificationServer = Constants.MTPNS; - } else if (pushNotificationServerType === PUSH_NOTIFICATIONS_MHPNS) { - pushNotificationServer = Constants.MHPNS; - } - - return { - pushNotificationServerType, - pushNotificationServer, - pushNotificationContents: config.EmailSettings.PushNotificationContents, - agree - }; - } - - renderTitle() { - return ( - - ); - } - - renderSettings() { - const pushNotificationServerTypes = []; - pushNotificationServerTypes.push({value: PUSH_NOTIFICATIONS_OFF, text: Utils.localizeMessage('admin.email.pushOff', 'Do not send push notifications')}); - if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.MHPNS === 'true') { - pushNotificationServerTypes.push({value: PUSH_NOTIFICATIONS_MHPNS, text: Utils.localizeMessage('admin.email.mhpns', 'Use encrypted, production-quality HPNS connection to iOS and Android apps')}); - } - pushNotificationServerTypes.push({value: PUSH_NOTIFICATIONS_MTPNS, text: Utils.localizeMessage('admin.email.mtpns', 'Use iOS and Android apps on iTunes and Google Play with TPNS')}); - pushNotificationServerTypes.push({value: PUSH_NOTIFICATIONS_CUSTOM, text: Utils.localizeMessage('admin.email.selfPush', 'Manually enter Push Notification Service location')}); - - let sendHelpText = null; - let pushServerHelpText = null; - if (this.state.pushNotificationServerType === PUSH_NOTIFICATIONS_OFF) { - sendHelpText = ( - - ); - } else if (this.state.pushNotificationServerType === PUSH_NOTIFICATIONS_MHPNS) { - pushServerHelpText = ( - - ); - } else if (this.state.pushNotificationServerType === PUSH_NOTIFICATIONS_MTPNS) { - pushServerHelpText = ( - - ); - } else { - pushServerHelpText = ( - - ); - } - - let tosCheckbox; - if (this.state.pushNotificationServerType === PUSH_NOTIFICATIONS_MHPNS) { - tosCheckbox = ( -
-
-
- - -
-
- ); - } - - return ( - - } - > - - } - value={this.state.pushNotificationServerType} - onChange={this.handleChange} - helpText={sendHelpText} - /> - {tosCheckbox} - - } - placeholder={Utils.localizeMessage('admin.email.pushServerEx', 'E.g.: "http://push-test.mattermost.com"')} - helpText={pushServerHelpText} - value={this.state.pushNotificationServer} - onChange={this.handleChange} - disabled={this.state.pushNotificationServerType !== PUSH_NOTIFICATIONS_CUSTOM} - /> - - } - value={this.state.pushNotificationContents} - onChange={this.handleChange} - disabled={this.state.pushNotificationServerType === PUSH_NOTIFICATIONS_OFF} - helpText={ - - } - /> - - ); - } -} -- cgit v1.2.3-1-g7c22