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/reset_status_modal/index.js | 34 ----- .../reset_status_modal/reset_status_modal.jsx | 142 --------------------- 2 files changed, 176 deletions(-) delete mode 100644 webapp/components/reset_status_modal/index.js delete mode 100644 webapp/components/reset_status_modal/reset_status_modal.jsx (limited to 'webapp/components/reset_status_modal') diff --git a/webapp/components/reset_status_modal/index.js b/webapp/components/reset_status_modal/index.js deleted file mode 100644 index 34f08c7a5..000000000 --- a/webapp/components/reset_status_modal/index.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import {connect} from 'react-redux'; -import {bindActionCreators} from 'redux'; - -import {Preferences} from 'mattermost-redux/constants'; -import {get} from 'mattermost-redux/selectors/entities/preferences'; - -import {savePreferences} from 'mattermost-redux/actions/preferences'; -import {setStatus} from 'mattermost-redux/actions/users'; -import {autoResetStatus} from 'actions/user_actions.jsx'; - -import ResetStatusModal from './reset_status_modal.jsx'; - -function mapStateToProps(state, ownProps) { - const {currentUserId} = state.entities.users; - return { - ...ownProps, - autoResetPref: get(state, Preferences.CATEGORY_AUTO_RESET_MANUAL_STATUS, currentUserId, '') - }; -} - -function mapDispatchToProps(dispatch) { - return { - actions: bindActionCreators({ - autoResetStatus, - setStatus, - savePreferences - }, dispatch) - }; -} - -export default connect(mapStateToProps, mapDispatchToProps)(ResetStatusModal); diff --git a/webapp/components/reset_status_modal/reset_status_modal.jsx b/webapp/components/reset_status_modal/reset_status_modal.jsx deleted file mode 100644 index 2e9bb8382..000000000 --- a/webapp/components/reset_status_modal/reset_status_modal.jsx +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import ConfirmModal from 'components/confirm_modal.jsx'; - -import {toTitleCase} from 'utils/utils.jsx'; - -import React from 'react'; -import PropTypes from 'prop-types'; -import {FormattedMessage} from 'react-intl'; -import {Preferences} from 'mattermost-redux/constants'; - -export default class ResetStatusModal extends React.PureComponent { - static propTypes = { - - /* - * The user's preference for whether their status is automatically reset - */ - autoResetPref: PropTypes.string, - actions: PropTypes.shape({ - - /* - * Function to get and then reset the user's status if needed - */ - autoResetStatus: PropTypes.func.isRequired, - - /* - * Function to set the status for a user - */ - setStatus: PropTypes.func.isRequired, - - /* - * Function to save user preferences - */ - savePreferences: PropTypes.func.isRequired - }).isRequired - } - - constructor(props) { - super(props); - - this.state = { - show: false, - currentUserStatus: {} - }; - } - - componentDidMount() { - this.props.actions.autoResetStatus().then( - (status) => { - const statusIsManual = status.manual; - const autoResetPrefNotSet = this.props.autoResetPref === ''; - - this.setState({ - currentUserStatus: status, // Set in state until status refactor where we store 'manual' field in redux - show: Boolean(statusIsManual && autoResetPrefNotSet) - }); - } - ); - } - - onConfirm = (checked) => { - this.setState({show: false}); - - const newStatus = {...this.state.currentUserStatus}; - newStatus.status = 'online'; - this.props.actions.setStatus(newStatus); - - if (checked) { - const pref = {category: Preferences.CATEGORY_AUTO_RESET_MANUAL_STATUS, user_id: newStatus.user_id, name: newStatus.user_id, value: 'true'}; - this.props.actions.savePreferences(pref.user_id, [pref]); - } - } - - onCancel = (checked) => { - this.setState({show: false}); - - if (checked) { - const status = {...this.state.currentUserStatus}; - const pref = {category: Preferences.CATEGORY_AUTO_RESET_MANUAL_STATUS, user_id: status.user_id, name: status.user_id, value: 'false'}; - this.props.actions.savePreferences(pref.user_id, [pref]); - } - } - - render() { - const userStatus = toTitleCase(this.state.currentUserStatus.status || ''); - const manualStatusTitle = ( - - ); - - const manualStatusMessage = ( - - ); - - const manualStatusButton = ( - - ); - - const manualStatusCancel = ( - - ); - - const manualStatusCheckbox = ( - - ); - - return ( - - ); - } -} -- cgit v1.2.3-1-g7c22