From 665500942b44a9d80b18a6d0483b65f4a94fabc0 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 6 Feb 2017 10:17:47 +0100 Subject: [PATCH] SONAR-8667 Hide groups on the "Profile" page when in "Cloud" mode --- .../main/js/apps/account/profile/Profile.js | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/account/profile/Profile.js b/server/sonar-web/src/main/js/apps/account/profile/Profile.js index 3d3213b7ea2..7c4bcd520a1 100644 --- a/server/sonar-web/src/main/js/apps/account/profile/Profile.js +++ b/server/sonar-web/src/main/js/apps/account/profile/Profile.js @@ -17,16 +17,29 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// @flow import React from 'react'; import { connect } from 'react-redux'; import UserExternalIdentity from './UserExternalIdentity'; import UserGroups from './UserGroups'; import UserScmAccounts from './UserScmAccounts'; -import { getCurrentUser } from '../../../store/rootReducer'; +import { getCurrentUser, areThereCustomOrganizations } from '../../../store/rootReducer'; class Profile extends React.Component { + props: { + customOrganizations: boolean, + user: { + email?: string, + externalProvider?: string, + groups: Array<*>, + local: boolean, + login: string, + scmAccounts: Array<*> + } + }; + render () { - const { user } = this.props; + const { customOrganizations, user } = this.props; return (
@@ -46,9 +59,12 @@ class Profile extends React.Component {
)} -
- - + {!customOrganizations && ( +
+ )} + {!customOrganizations && ( + + )}
@@ -58,6 +74,9 @@ class Profile extends React.Component { } } -export default connect( - state => ({ user: getCurrentUser(state) }) -)(Profile); +const mapStateToProps = state => ({ + customOrganizations: areThereCustomOrganizations(state), + user: getCurrentUser(state) +}); + +export default connect(mapStateToProps)(Profile); -- 2.39.5