diff --git a/client/actions/user.js b/client/actions/user.js
index 558b44273..9a505098d 100644
--- a/client/actions/user.js
+++ b/client/actions/user.js
@@ -5,7 +5,6 @@ import * as constants from '../constants';
import { fetchUserLogs } from './userLog';
import { fetchUserDevices } from './userDevice';
import { getAccessLevel } from './auth';
-import { removeBlockedIPs } from "../reducers/removeBlockedIPs";
const addRequiredTextParam = (url, languageDictionary) => {
languageDictionary = languageDictionary || {};
@@ -77,10 +76,15 @@ export function createUser(user, languageDictionary) {
export function requestCreateUser(memberships) {
return (dispatch, getState) => {
const connections = getState().connections.get('records').toJS();
+
+ const connection = connections.length === 0
+ ? null
+ : connections && connections.length && connections[0].name
+
dispatch({
type: constants.REQUEST_CREATE_USER,
payload: {
- connection: connections && connections.length && connections[0].name,
+ connection,
memberships: memberships && memberships.length === 1 ? [ memberships[0] ] : [ ]
}
});
diff --git a/client/containers/Users/Users.jsx b/client/containers/Users/Users.jsx
index 62044f913..da5768b6b 100644
--- a/client/containers/Users/Users.jsx
+++ b/client/containers/Users/Users.jsx
@@ -15,6 +15,7 @@ import './Users.styles.css';
class Users extends Component {
static propTypes = {
loading: PropTypes.bool.isRequired,
+ connectionsLoading: PropTypes.bool.isRequired,
error: PropTypes.string,
users: PropTypes.array,
connections: PropTypes.array,
@@ -44,7 +45,9 @@ class Users extends Component {
componentWillMount = () => {
this.props.fetchUsers();
- this.props.fetchConnections();
+ if (!this.props.connectionsLoading) {
+ this.props.fetchConnections();
+ }
};
onPageChange = (page) => {
@@ -77,7 +80,7 @@ class Users extends Component {
error,
users,
total,
- connections,
+ connectionsLoading,
accessLevel,
nextPage,
pages,
@@ -102,7 +105,7 @@ class Users extends Component {
{languageDictionary.usersTitle || 'Users'}
- {(connections.length && role > 0 && showCreateUser) ?
+ {( !connectionsLoading && role > 0 && showCreateUser) ?