diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/about_build_modal.jsx | 62 | ||||
-rw-r--r-- | web/react/components/create_comment.jsx | 3 | ||||
-rw-r--r-- | web/react/components/navbar_dropdown.jsx | 22 | ||||
-rw-r--r-- | web/react/components/post_deleted_modal.jsx | 36 | ||||
-rw-r--r-- | web/react/components/rhs_thread.jsx | 11 | ||||
-rw-r--r-- | web/react/components/user_settings/user_settings_security.jsx | 11 |
6 files changed, 125 insertions, 20 deletions
diff --git a/web/react/components/about_build_modal.jsx b/web/react/components/about_build_modal.jsx new file mode 100644 index 000000000..d582f6bc8 --- /dev/null +++ b/web/react/components/about_build_modal.jsx @@ -0,0 +1,62 @@ +// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// See License.txt for license information. + +var Modal = ReactBootstrap.Modal; + +export default class AboutBuildModal extends React.Component { + constructor(props) { + super(props); + this.doHide = this.doHide.bind(this); + } + + doHide() { + this.props.onModalDismissed(); + } + + render() { + const config = global.window.config; + + return ( + <Modal + show={this.props.show} + onHide={this.doHide} + > + <Modal.Header closeButton={true}> + <Modal.Title>{`Mattermost ${config.Version}`}</Modal.Title> + </Modal.Header> + <Modal.Body> + <div className='row form-group'> + <div className='col-sm-3 info__label'>{'Build Number:'}</div> + <div className='col-sm-9'>{config.BuildNumber}</div> + </div> + <div className='row form-group'> + <div className='col-sm-3 info__label'>{'Build Date:'}</div> + <div className='col-sm-9'>{config.BuildDate}</div> + </div> + <div className='row'> + <div className='col-sm-3 info__label'>{'Build Hash:'}</div> + <div className='col-sm-9'>{config.BuildHash}</div> + </div> + </Modal.Body> + <Modal.Footer> + <button + type='button' + className='btn btn-default' + onClick={this.doHide} + > + {'Close'} + </button> + </Modal.Footer> + </Modal> + ); + } +} + +AboutBuildModal.defaultProps = { + show: false +}; + +AboutBuildModal.propTypes = { + show: React.PropTypes.bool.isRequired, + onModalDismissed: React.PropTypes.func.isRequired +};
\ No newline at end of file diff --git a/web/react/components/create_comment.jsx b/web/react/components/create_comment.jsx index 9c233ea26..550f85d3d 100644 --- a/web/react/components/create_comment.jsx +++ b/web/react/components/create_comment.jsx @@ -106,10 +106,11 @@ export default class CreateComment extends React.Component { let state = {}; if (err.message === 'Invalid RootId parameter') { + PostStore.removePendingPost(post.channel_id, post.pending_post_id); + if ($('#post_deleted').length > 0) { $('#post_deleted').modal('show'); } - PostStore.removePendingPost(post.pending_post_id); } else { post.state = Constants.POST_FAILED; PostStore.updatePendingPost(post); diff --git a/web/react/components/navbar_dropdown.jsx b/web/react/components/navbar_dropdown.jsx index 30c4e94ae..ff7a53848 100644 --- a/web/react/components/navbar_dropdown.jsx +++ b/web/react/components/navbar_dropdown.jsx @@ -6,6 +6,8 @@ var client = require('../utils/client.jsx'); var UserStore = require('../stores/user_store.jsx'); var TeamStore = require('../stores/team_store.jsx'); +var AboutBuildModal = require('./about_build_modal.jsx'); + var Constants = require('../utils/constants.jsx'); function getStateFromStores() { @@ -18,7 +20,9 @@ export default class NavbarDropdown extends React.Component { this.blockToggle = false; this.handleLogoutClick = this.handleLogoutClick.bind(this); + this.handleAboutModal = this.handleAboutModal.bind(this); this.onListenerChange = this.onListenerChange.bind(this); + this.aboutModalDismissed = this.aboutModalDismissed.bind(this); this.state = getStateFromStores(); } @@ -26,6 +30,12 @@ export default class NavbarDropdown extends React.Component { e.preventDefault(); client.logout(); } + handleAboutModal() { + this.setState({showAboutModal: true}); + } + aboutModalDismissed() { + this.setState({showAboutModal: false}); + } componentDidMount() { UserStore.addTeamsChangeListener(this.onListenerChange); TeamStore.addChangeListener(this.onListenerChange); @@ -228,6 +238,18 @@ export default class NavbarDropdown extends React.Component { {'Report a Problem'} </a> </li> + <li> + <a + href='#' + onClick={this.handleAboutModal} + > + {'About Mattermost'} + </a> + </li> + <AboutBuildModal + show={this.state.showAboutModal} + onModalDismissed={this.aboutModalDismissed} + /> </ul> </li> </ul> diff --git a/web/react/components/post_deleted_modal.jsx b/web/react/components/post_deleted_modal.jsx index d284a9d1b..3f487d20f 100644 --- a/web/react/components/post_deleted_modal.jsx +++ b/web/react/components/post_deleted_modal.jsx @@ -2,13 +2,41 @@ // See License.txt for license information. var UserStore = require('../stores/user_store.jsx'); +var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); +var Constants = require('../utils/constants.jsx'); +var ActionTypes = Constants.ActionTypes; export default class PostDeletedModal extends React.Component { constructor(props) { super(props); + this.handleClose = this.handleClose.bind(this); + this.state = {}; } + componentDidMount() { + $(React.findDOMNode(this.refs.modal)).on('hidden.bs.modal', () => { + this.handleClose(); + }); + } + handleClose() { + AppDispatcher.handleServerAction({ + type: ActionTypes.RECIEVED_SEARCH, + results: null + }); + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECIEVED_SEARCH_TERM, + term: null, + do_search: false, + is_mention_search: false + }); + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECIEVED_POST_SELECTED, + results: null + }); + } render() { var currentUser = UserStore.getCurrentUser(); @@ -31,17 +59,17 @@ export default class PostDeletedModal extends React.Component { data-dismiss='modal' aria-label='Close' > - <span aria-hidden='true'>×</span> + <span aria-hidden='true'>{'×'}</span> </button> <h4 className='modal-title' id='myModalLabel' > - Comment could not be posted + {'Comment could not be posted'} </h4> </div> <div className='modal-body'> - <p>Someone deleted the message on which you tried to post a comment.</p> + <p>{'Someone deleted the message on which you tried to post a comment.'}</p> </div> <div className='modal-footer'> <button @@ -49,7 +77,7 @@ export default class PostDeletedModal extends React.Component { className='btn btn-primary' data-dismiss='modal' > - Okay + {'Okay'} </button> </div> </div> diff --git a/web/react/components/rhs_thread.jsx b/web/react/components/rhs_thread.jsx index 2f23d80d9..27a784701 100644 --- a/web/react/components/rhs_thread.jsx +++ b/web/react/components/rhs_thread.jsx @@ -23,7 +23,7 @@ export default class RhsThread extends React.Component { } getStateFromStores() { var postList = PostStore.getSelectedPost(); - if (!postList || postList.order.length < 1) { + if (!postList || postList.order.length < 1 || !postList.posts[postList.order[0]]) { return {postList: {}}; } @@ -49,7 +49,10 @@ export default class RhsThread extends React.Component { }.bind(this)); } componentDidUpdate() { - $('.post-right__scroll').scrollTop($('.post-right__scroll')[0].scrollHeight); + if ($('.post-right__scroll')[0]) { + $('.post-right__scroll').scrollTop($('.post-right__scroll')[0].scrollHeight); + } + $('.post-right__scroll').perfectScrollbar('update'); this.resize(); } @@ -67,7 +70,7 @@ export default class RhsThread extends React.Component { // if something was changed in the channel like adding a // comment or post then lets refresh the sidebar list var currentSelected = PostStore.getSelectedPost(); - if (!currentSelected || currentSelected.order.length === 0) { + if (!currentSelected || currentSelected.order.length === 0 || !currentSelected.posts[currentSelected.order[0]]) { return; } @@ -103,7 +106,7 @@ export default class RhsThread extends React.Component { render() { var postList = this.state.postList; - if (postList == null) { + if (postList == null || !postList.order) { return ( <div></div> ); diff --git a/web/react/components/user_settings/user_settings_security.jsx b/web/react/components/user_settings/user_settings_security.jsx index b59c08af0..4ff4775a7 100644 --- a/web/react/components/user_settings/user_settings_security.jsx +++ b/web/react/components/user_settings/user_settings_security.jsx @@ -251,17 +251,6 @@ export default class SecurityTab extends React.Component { <div className='divider-dark first'/> {passwordSection} <div className='divider-dark'/> - <ul - className='section-min' - > - <li className='col-sm-10 section-title'>{'Version ' + global.window.config.Version}</li> - <li className='col-sm-7 section-describe'> - <div className='text-nowrap'>{'Build Number: ' + global.window.config.BuildNumber}</div> - <div className='text-nowrap'>{'Build Date: ' + global.window.config.BuildDate}</div> - <div className='text-nowrap'>{'Build Hash: ' + global.window.config.BuildHash}</div> - </li> - </ul> - <div className='divider-dark'/> <br></br> <a data-toggle='modal' |