diff options
Diffstat (limited to 'web/react')
-rw-r--r-- | web/react/components/access_history_modal.jsx | 16 | ||||
-rw-r--r-- | web/react/components/activity_log_modal.jsx | 17 | ||||
-rw-r--r-- | web/react/components/channel_header.jsx | 12 | ||||
-rw-r--r-- | web/react/components/post_list.jsx | 5 | ||||
-rw-r--r-- | web/react/components/signup_team_complete.jsx | 36 | ||||
-rw-r--r-- | web/react/stores/user_store.jsx | 4 |
6 files changed, 58 insertions, 32 deletions
diff --git a/web/react/components/access_history_modal.jsx b/web/react/components/access_history_modal.jsx index 462f046f6..6cc8ec8a9 100644 --- a/web/react/components/access_history_modal.jsx +++ b/web/react/components/access_history_modal.jsx @@ -3,7 +3,8 @@ var UserStore = require('../stores/user_store.jsx'); var AsyncClient = require('../utils/async_client.jsx'); -var Utils = require('../utils/utils.jsx'); +var LoadingScreen = require('./loading_screen.jsx'); +var utils = require('../utils/utils.jsx'); function getStateFromStoresForAudits() { return { @@ -14,7 +15,9 @@ function getStateFromStoresForAudits() { module.exports = React.createClass({ componentDidMount: function() { UserStore.addAuditsChangeListener(this._onChange); - AsyncClient.getAudits(); + $(this.refs.modal.getDOMNode()).on('shown.bs.modal', function (e) { + AsyncClient.getAudits(); + }); var self = this; $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', function(e) { @@ -25,7 +28,10 @@ module.exports = React.createClass({ UserStore.removeAuditsChangeListener(this._onChange); }, _onChange: function() { - this.setState(getStateFromStoresForAudits()); + var newState = getStateFromStoresForAudits(); + if (!utils.areStatesEqual(newState.audits, this.state.audits)) { + this.setState(newState); + } }, handleMoreInfo: function(index) { var newMoreInfo = this.state.moreInfo; @@ -87,9 +93,13 @@ module.exports = React.createClass({ <h4 className="modal-title" id="myModalLabel">Access History</h4> </div> <div ref="modalBody" className="modal-body"> + { !this.state.audits.loading ? <form role="form"> { accessList } </form> + : + <LoadingScreen /> + } </div> </div> </div> diff --git a/web/react/components/activity_log_modal.jsx b/web/react/components/activity_log_modal.jsx index 90f139e8b..f28f0d5f1 100644 --- a/web/react/components/activity_log_modal.jsx +++ b/web/react/components/activity_log_modal.jsx @@ -4,6 +4,8 @@ var UserStore = require('../stores/user_store.jsx'); var Client = require('../utils/client.jsx'); var AsyncClient = require('../utils/async_client.jsx'); +var LoadingScreen = require('./loading_screen.jsx'); +var utils = require('../utils/utils.jsx'); function getStateFromStoresForSessions() { return { @@ -29,7 +31,9 @@ module.exports = React.createClass({ }, componentDidMount: function() { UserStore.addSessionsChangeListener(this._onChange); - AsyncClient.getSessions(); + $(this.refs.modal.getDOMNode()).on('shown.bs.modal', function (e) { + AsyncClient.getSessions(); + }); var self = this; $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', function(e) { @@ -40,7 +44,10 @@ module.exports = React.createClass({ UserStore.removeSessionsChangeListener(this._onChange); }, _onChange: function() { - this.setState(getStateFromStoresForSessions()); + var newState = getStateFromStoresForSessions(); + if (!utils.areStatesEqual(newState.sessions, this.state.sessions)) { + this.setState(newState); + } }, handleMoreInfo: function(index) { var newMoreInfo = this.state.moreInfo; @@ -106,10 +113,16 @@ module.exports = React.createClass({ </div> <p className="session-help-text">Sessions are created when you log in with your email and password to a new browser on a device. Sessions let you use Mattermost for up to 30 days without having to log in again. If you want to log out sooner, use the "Logout" button below to end a session.</p> <div ref="modalBody" className="modal-body"> + { !this.state.sessions.loading ? + <div> <form role="form"> { activityList } </form> { server_error } + </div> + : + <LoadingScreen /> + } </div> </div> </div> diff --git a/web/react/components/channel_header.jsx b/web/react/components/channel_header.jsx index 7a129f200..76dbe370b 100644 --- a/web/react/components/channel_header.jsx +++ b/web/react/components/channel_header.jsx @@ -153,7 +153,7 @@ module.exports = React.createClass({ if (isDirect) { if (this.state.users.length > 1) { var contact = this.state.users[((this.state.users[0].id === currentId) ? 1 : 0)]; - channelTitle = <UserProfile userId={contact.id} overwriteName={contact.nickname || contact.username} />; + channelTitle = contact.nickname || contact.username; } } @@ -161,13 +161,13 @@ module.exports = React.createClass({ <table className="channel-header alt"> <tr> <th> - { !isDirect ? <div className="channel-header__info"> <div className="dropdown"> <a href="#" className="dropdown-toggle theme" type="button" id="channel_header_dropdown" data-toggle="dropdown" aria-expanded="true"> <strong className="heading">{channelTitle} </strong> <span className="glyphicon glyphicon-chevron-down header-dropdown__icon"></span> </a> + { !isDirect ? <ul className="dropdown-menu" role="menu" aria-labelledby="channel_header_dropdown"> <li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#channel_info" data-channelid={channel.id} href="#">View Info</a></li> { !ChannelStore.isDefault(channel) ? @@ -193,12 +193,14 @@ module.exports = React.createClass({ : null } </ul> + : + <ul className="dropdown-menu" role="menu" aria-labelledby="channel_header_dropdown"> + <li role="presentation"><a role="menuitem" href="#" data-toggle="modal" data-target="#edit_channel" data-desc={channel.description} data-title={channel.display_name} data-channelid={channel.id}>Set Channel Description...</a></li> + </ul> + } </div> <div data-toggle="popover" data-content={popoverContent} className="description">{description}</div> </div> - : - <a href="#"><strong className="heading">{channelTitle}</strong></a> - } </th> <th><PopoverListMembers members={this.state.users} channelId={channel.id} /></th> <th className="search-bar__container"><NavbarSearchBox /></th> diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx index 8dc5013ca..f9c62bf20 100644 --- a/web/react/components/post_list.jsx +++ b/web/react/components/post_list.jsx @@ -309,12 +309,15 @@ module.exports = React.createClass({ var more_messages = <p className="beginning-messages-text">Beginning of Channel</p>; + var userStyle = { color: UserStore.getCurrentUser().props.theme } + if (channel != null) { if (order.length > 0 && order.length % Constants.POST_CHUNK_SIZE === 0) { more_messages = <a ref="loadmore" className="more-messages-text theme" href="#" onClick={this.getMorePosts}>Load more messages</a>; } else if (channel.type === 'D') { var teammate = utils.getDirectTeammate(channel.id) + if (teammate) { var teammate_name = teammate.nickname.length > 0 ? teammate.nickname : teammate.username; more_messages = ( @@ -329,6 +332,7 @@ module.exports = React.createClass({ {"This is the start of your private message history with " + teammate_name + "." }<br/> {"Private messages and files shared here are not shown to people outside this area."} </p> + <a className="intro-links" href="#" style={userStyle} data-toggle="modal" data-target="#edit_channel" data-desc={channel.description} data-title={channel.display_name} data-channelid={channel.id}><i className="fa fa-pencil"></i>Set a description</a> </div> ); } else { @@ -342,7 +346,6 @@ module.exports = React.createClass({ var ui_name = channel.display_name var members = ChannelStore.getCurrentExtraInfo().members; var creator_name = ""; - var userStyle = { color: UserStore.getCurrentUser().props.theme } for (var i = 0; i < members.length; i++) { if (members[i].roles.indexOf('admin') > -1) { diff --git a/web/react/components/signup_team_complete.jsx b/web/react/components/signup_team_complete.jsx index e7b37ef39..55845fc26 100644 --- a/web/react/components/signup_team_complete.jsx +++ b/web/react/components/signup_team_complete.jsx @@ -587,25 +587,23 @@ PasswordPage = React.createClass({ var props = this.props; - setTimeout(function() { - $('#sign-up-button').button('reset'); - props.state.wizard = "finished"; - props.updateParent(props.state, true); - - window.location.href = utils.getWindowLocationOrigin() + '/' + props.state.team.name + '/login?email=' + encodeURIComponent(teamSignup.team.email); - - // client.loginByEmail(teamSignup.team.domain, teamSignup.team.email, teamSignup.user.password, - // function(data) { - // TeamStore.setLastName(teamSignup.team.domain); - // UserStore.setLastEmail(teamSignup.team.email); - // UserStore.setCurrentUser(data); - // window.location.href = '/channels/town-square'; - // }.bind(ctl), - // function(err) { - // this.setState({name_error: err.message}); - // }.bind(ctl) - // ); - }, 5000); + $('#sign-up-button').button('reset'); + props.state.wizard = "finished"; + props.updateParent(props.state, true); + + window.location.href = utils.getWindowLocationOrigin() + '/' + props.state.team.name + '/login?email=' + encodeURIComponent(teamSignup.team.email); + + // client.loginByEmail(teamSignup.team.domain, teamSignup.team.email, teamSignup.user.password, + // function(data) { + // TeamStore.setLastName(teamSignup.team.domain); + // UserStore.setLastEmail(teamSignup.team.email); + // UserStore.setCurrentUser(data); + // window.location.href = '/channels/town-square'; + // }.bind(ctl), + // function(err) { + // this.setState({name_error: err.message}); + // }.bind(ctl) + // ); }.bind(this), function(err) { this.setState({server_error: err.message}); diff --git a/web/react/stores/user_store.jsx b/web/react/stores/user_store.jsx index 001162f47..aff5a0bed 100644 --- a/web/react/stores/user_store.jsx +++ b/web/react/stores/user_store.jsx @@ -164,13 +164,13 @@ var UserStore = assign({}, EventEmitter.prototype, { BrowserStore.setItem("sessions", sessions); }, getSessions: function() { - return BrowserStore.getItem("sessions", []); + return BrowserStore.getItem("sessions", {loading: true}); }, setAudits: function(audits) { BrowserStore.setItem("audits", audits); }, getAudits: function() { - return BrowserStore.getItem("audits", []); + return BrowserStore.getItem("audits", {loading: true}); }, setTeams: function(teams) { BrowserStore.setItem("teams", teams); |