diff --git a/web/react/components/access_history_modal.jsx b/web/react/components/access_history_modal.jsx
index 16768a1196..a19e5c16e2 100644
--- a/web/react/components/access_history_modal.jsx
+++ b/web/react/components/access_history_modal.jsx
@@ -13,21 +13,23 @@ function getStateFromStoresForAudits() {
}
module.exports = React.createClass({
+ displayName: 'AccessHistoryModal',
componentDidMount: function() {
- UserStore.addAuditsChangeListener(this._onChange);
- $(this.refs.modal.getDOMNode()).on('shown.bs.modal', function(e) {
+ UserStore.addAuditsChangeListener(this.onListenerChange);
+ $(this.refs.modal.getDOMNode()).on('shown.bs.modal', function() {
AsyncClient.getAudits();
});
var self = this;
- $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', function(e) {
+ $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', function() {
+ $('#user_settings').modal('show');
self.setState({moreInfo: []});
});
},
componentWillUnmount: function() {
- UserStore.removeAuditsChangeListener(this._onChange);
+ UserStore.removeAuditsChangeListener(this.onListenerChange);
},
- _onChange: function() {
+ onListenerChange: function() {
var newState = getStateFromStoresForAudits();
if (!utils.areStatesEqual(newState.audits, this.state.audits)) {
this.setState(newState);
@@ -61,6 +63,21 @@ module.exports = React.createClass({
currentAudit.session_id = 'N/A (Login attempt)';
}
+ var moreInfo = (More info );
+ if (this.state.moreInfo[i]) {
+ moreInfo = (
+
+
{'Session ID: ' + currentAudit.session_id}
+
{'URL: ' + currentAudit.action.replace(/\/api\/v[1-9]/, '')}
+
+ );
+ }
+
+ var divider = null;
+ if (i < this.state.audits.length - 1) {
+ divider = (
)
+ }
+
accessList[i] = (
{newDate}
@@ -68,25 +85,21 @@ module.exports = React.createClass({
{newHistoryDate.toLocaleTimeString(navigator.language, {hour: '2-digit', minute: '2-digit'})}
{'IP: ' + currentAudit.ip_address}
- {this.state.moreInfo[i] ?
-
-
{'Session ID: ' + currentAudit.session_id}
-
{'URL: ' + currentAudit.action.replace(/\/api\/v[1-9]/, '')}
-
- :
-
More info
- }
+ {moreInfo}
- {i < this.state.audits.length - 1 ?
-
- :
- null
- }
+ {divider}
);
}
+ var content;
+ if (this.state.audits.loading) {
+ content = ( );
+ } else {
+ content = ();
+ }
+
return (
@@ -97,13 +110,7 @@ module.exports = React.createClass({
Access History
- {!this.state.audits.loading ?
-
- :
-
- }
+ {content}
diff --git a/web/react/components/activity_log_modal.jsx b/web/react/components/activity_log_modal.jsx
index f28f0d5f1d..1192a72bc7 100644
--- a/web/react/components/activity_log_modal.jsx
+++ b/web/react/components/activity_log_modal.jsx
@@ -10,40 +10,41 @@ var utils = require('../utils/utils.jsx');
function getStateFromStoresForSessions() {
return {
sessions: UserStore.getSessions(),
- server_error: null,
- client_error: null
+ serverError: null,
+ clientError: null
};
}
module.exports = React.createClass({
+ displayName: 'ActivityLogModal',
submitRevoke: function(altId) {
- var self = this;
Client.revokeSession(altId,
function(data) {
AsyncClient.getSessions();
}.bind(this),
function(err) {
- state = getStateFromStoresForSessions();
- state.server_error = err;
+ var state = getStateFromStoresForSessions();
+ state.serverError = err;
this.setState(state);
}.bind(this)
);
},
componentDidMount: function() {
- UserStore.addSessionsChangeListener(this._onChange);
+ UserStore.addSessionsChangeListener(this.onListenerChange);
$(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) {
- self.setState({ moreInfo: [] });
+ $('#user_settings').modal('show');
+ self.setState({moreInfo: []});
});
},
componentWillUnmount: function() {
- UserStore.removeSessionsChangeListener(this._onChange);
+ UserStore.removeSessionsChangeListener(this.onListenerChange);
},
- _onChange: function() {
+ onListenerChange: function() {
var newState = getStateFromStoresForSessions();
if (!utils.areStatesEqual(newState.sessions, this.state.sessions)) {
this.setState(newState);
@@ -52,7 +53,7 @@ module.exports = React.createClass({
handleMoreInfo: function(index) {
var newMoreInfo = this.state.moreInfo;
newMoreInfo[index] = true;
- this.setState({ moreInfo: newMoreInfo });
+ this.setState({moreInfo: newMoreInfo});
},
getInitialState: function() {
var initialState = getStateFromStoresForSessions();
@@ -61,68 +62,76 @@ module.exports = React.createClass({
},
render: function() {
var activityList = [];
- var server_error = this.state.server_error ? this.state.server_error : null;
+ var serverError = this.state.serverError;
+
+ // Squash any false-y value for server error into null
+ if (!serverError) {
+ serverError = null;
+ }
for (var i = 0; i < this.state.sessions.length; i++) {
var currentSession = this.state.sessions[i];
var lastAccessTime = new Date(currentSession.last_activity_at);
var firstAccessTime = new Date(currentSession.create_at);
- var devicePicture = "";
+ var devicePicture = '';
- if (currentSession.props.platform === "Windows") {
- devicePicture = "fa fa-windows";
+ if (currentSession.props.platform === 'Windows') {
+ devicePicture = 'fa fa-windows';
}
- else if (currentSession.props.platform === "Macintosh" || currentSession.props.platform === "iPhone") {
- devicePicture = "fa fa-apple";
+ else if (currentSession.props.platform === 'Macintosh' || currentSession.props.platform === 'iPhone') {
+ devicePicture = 'fa fa-apple';
}
- else if (currentSession.props.platform === "Linux") {
- devicePicture = "fa fa-linux";
+ else if (currentSession.props.platform === 'Linux') {
+ devicePicture = 'fa fa-linux';
+ }
+
+ var moreInfo;
+ if (this.state.moreInfo[i]) {
+ moreInfo = (
+
+
{'First time active: ' + firstAccessTime.toDateString() + ', ' + lastAccessTime.toLocaleTimeString()}
+
{'OS: ' + currentSession.props.os}
+
{'Browser: ' + currentSession.props.browser}
+
{'Session ID: ' + currentSession.alt_id}
+
+ );
+ } else {
+ moreInfo = (More info );
}
activityList[i] = (
-
-
-
{currentSession.props.platform}
-
-
{"Last activity: " + lastAccessTime.toDateString() + ", " + lastAccessTime.toLocaleTimeString()}
- { this.state.moreInfo[i] ?
-
-
{"First time active: " + firstAccessTime.toDateString() + ", " + lastAccessTime.toLocaleTimeString()}
-
{"OS: " + currentSession.props.os}
-
{"Browser: " + currentSession.props.browser}
-
{"Session ID: " + currentSession.alt_id}
-
- :
-
More info
- }
+
+
+
{currentSession.props.platform}
+
+
{'Last activity: ' + lastAccessTime.toDateString() + ', ' + lastAccessTime.toLocaleTimeString()}
+ {moreInfo}
-
Logout
+
Logout
);
}
+ var content;
+ if (this.state.sessions.loading) {
+ content = (
);
+ } else {
+ content = (
);
+ }
+
return (
-
-
-
-
-
×
-
Active Sessions
+
+
+
+
+ ×
+
Active Sessions
-
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.
-
- { !this.state.sessions.loading ?
-
-
- { server_error }
-
- :
-
- }
+
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.
+
+ {content}
diff --git a/web/react/components/sidebar_header.jsx b/web/react/components/sidebar_header.jsx
index cc3f255eed..761c06e742 100644
--- a/web/react/components/sidebar_header.jsx
+++ b/web/react/components/sidebar_header.jsx
@@ -96,7 +96,7 @@ var NavbarDropdown = React.createClass({
- Account Settings
+ Account Settings
{teamSettings}
{inviteLink}
{teamLink}
diff --git a/web/react/components/sidebar_right_menu.jsx b/web/react/components/sidebar_right_menu.jsx
index 2439719a1c..d221ca8409 100644
--- a/web/react/components/sidebar_right_menu.jsx
+++ b/web/react/components/sidebar_right_menu.jsx
@@ -72,7 +72,7 @@ module.exports = React.createClass({
- Account Settings
+ Account Settings
{teamSettingsLink}
{inviteLink}
{teamLink}
diff --git a/web/react/components/user_settings.jsx b/web/react/components/user_settings.jsx
index 1a0c313d3c..a5fa01dc9b 100644
--- a/web/react/components/user_settings.jsx
+++ b/web/react/components/user_settings.jsx
@@ -105,11 +105,11 @@ var NotificationsTab = React.createClass({
},
componentDidMount: function() {
UserStore.addChangeListener(this._onChange);
- $('#user_settings1').on('hidden.bs.modal', this.handleClose);
+ $('#user_settings').on('hidden.bs.modal', this.handleClose);
},
componentWillUnmount: function() {
UserStore.removeChangeListener(this._onChange);
- $('#user_settings1').off('hidden.bs.modal', this.handleClose);
+ $('#user_settings').off('hidden.bs.modal', this.handleClose);
this.props.updateSection('');
},
_onChange: function() {
@@ -513,27 +513,34 @@ var SecurityTab = React.createClass({
this.setState({confirmPassword: e.target.value});
},
handleHistoryOpen: function() {
- $('#user_settings1').modal('hide');
+ this.setState({willReturn: true});
+ $("#user_settings").modal('hide');
},
handleDevicesOpen: function() {
- $('#user_settings1').modal('hide');
+ this.setState({willReturn: true});
+ $("#user_settings").modal('hide');
},
handleClose: function() {
$(this.getDOMNode()).find('.form-control').each(function() {
this.value = '';
});
this.setState({currentPassword: '', newPassword: '', confirmPassword: '', serverError: null, passwordError: null});
- this.props.updateTab('general');
+
+ if (!this.state.willReturn) {
+ this.props.updateTab('general');
+ } else {
+ this.setState({willReturn: false});
+ }
},
componentDidMount: function() {
- $('#user_settings1').on('hidden.bs.modal', this.handleClose);
+ $('#user_settings').on('hidden.bs.modal', this.handleClose);
},
componentWillUnmount: function() {
- $('#user_settings1').off('hidden.bs.modal', this.handleClose);
+ $('#user_settings').off('hidden.bs.modal', this.handleClose);
this.props.updateSection('');
},
getInitialState: function() {
- return {currentPassword: '', newPassword: '', confirmPassword: ''};
+ return {currentPassword: '', newPassword: '', confirmPassword: '', willReturn: false};
},
render: function() {
var serverError = this.state.serverError ? this.state.serverError : null;
@@ -811,10 +818,10 @@ var GeneralTab = React.createClass({
this.props.updateSection('');
},
componentDidMount: function() {
- $('#user_settings1').on('hidden.bs.modal', this.handleClose);
+ $('#user_settings').on('hidden.bs.modal', this.handleClose);
},
componentWillUnmount: function() {
- $('#user_settings1').off('hidden.bs.modal', this.handleClose);
+ $('#user_settings').off('hidden.bs.modal', this.handleClose);
},
getInitialState: function() {
var user = this.props.user;
@@ -1093,7 +1100,7 @@ var AppearanceTab = React.createClass({
if (this.props.activeSection === "theme") {
$(this.refs[this.state.theme].getDOMNode()).addClass('active-border');
}
- $('#user_settings1').on('hidden.bs.modal', this.handleClose);
+ $('#user_settings').on('hidden.bs.modal', this.handleClose);
},
componentDidUpdate: function() {
if (this.props.activeSection === "theme") {
@@ -1102,7 +1109,7 @@ var AppearanceTab = React.createClass({
}
},
componentWillUnmount: function() {
- $('#user_settings1').off('hidden.bs.modal', this.handleClose);
+ $('#user_settings').off('hidden.bs.modal', this.handleClose);
this.props.updateSection('');
},
getInitialState: function() {
diff --git a/web/react/components/user_settings_modal.jsx b/web/react/components/user_settings_modal.jsx
index 702e7ad7a1..7181c40206 100644
--- a/web/react/components/user_settings_modal.jsx
+++ b/web/react/components/user_settings_modal.jsx
@@ -32,7 +32,7 @@ module.exports = React.createClass({
tabs.push({name: "appearance", ui_name: "Appearance", icon: "glyphicon glyphicon-wrench"});
return (
-
+
@@ -64,4 +64,3 @@ module.exports = React.createClass({
);
}
});
-
diff --git a/web/sass-files/sass/partials/_responsive.scss b/web/sass-files/sass/partials/_responsive.scss
index 47b2b6bd74..f28df1f899 100644
--- a/web/sass-files/sass/partials/_responsive.scss
+++ b/web/sass-files/sass/partials/_responsive.scss
@@ -431,9 +431,6 @@
}
}
}
- #user_settings {
- border-right: none;
- }
body {
&.white {
.inner__wrap {
diff --git a/web/sass-files/sass/partials/_settings.scss b/web/sass-files/sass/partials/_settings.scss
index 1fb078bb96..0262ef60ce 100644
--- a/web/sass-files/sass/partials/_settings.scss
+++ b/web/sass-files/sass/partials/_settings.scss
@@ -143,12 +143,6 @@
}
}
-#user_settings {
- padding: 0 0.5em;
- border-right: 1px solid #ddd;
- max-width: 800px;
-}
-
.channel-settings {
padding: 0 10px;
}