diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/account')
-rw-r--r-- | server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js index 82e5fb84797..1aebb594952 100644 --- a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js +++ b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js @@ -25,16 +25,15 @@ import { Link } from 'react-router'; import OrganizationsList from './OrganizationsList'; import { translate } from '../../../helpers/l10n'; import { fetchIfAnyoneCanCreateOrganizations, fetchMyOrganizations } from './actions'; -import { getMyOrganizations, getSettingValue, getCurrentUser } from '../../../store/rootReducer'; +import { getAppState, getMyOrganizations, getSettingValue } from '../../../store/rootReducer'; import type { Organization } from '../../../store/organizations/duck'; -import { isUserAdmin } from '../../../helpers/users'; class UserOrganizations extends React.PureComponent { mounted: boolean; props: { anyoneCanCreate?: { value: string }, - currentUser: Object, + canAdmin: boolean, children?: React.Element<*>, organizations: Array<Organization>, fetchIfAnyoneCanCreateOrganizations: () => Promise<*>, @@ -65,8 +64,7 @@ class UserOrganizations extends React.PureComponent { const anyoneCanCreate = this.props.anyoneCanCreate != null && this.props.anyoneCanCreate.value === 'true'; - const canCreateOrganizations = - !this.state.loading && (anyoneCanCreate || isUserAdmin(this.props.currentUser)); + const canCreateOrganizations = !this.state.loading && (anyoneCanCreate || this.props.canAdmin); return ( <div className="account-body account-container"> @@ -101,7 +99,7 @@ class UserOrganizations extends React.PureComponent { const mapStateToProps = state => ({ anyoneCanCreate: getSettingValue(state, 'sonar.organizations.anyoneCanCreate'), - currentUser: getCurrentUser(state), + canAdmin: getAppState(state).canAdmin, organizations: getMyOrganizations(state) }); |