]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8667 Hide groups on the "Profile" page when in "Cloud" mode
authorStas Vilchik <vilchiks@gmail.com>
Mon, 6 Feb 2017 09:17:47 +0000 (10:17 +0100)
committerStas Vilchik <stas-vilchik@users.noreply.github.com>
Tue, 7 Feb 2017 12:10:37 +0000 (13:10 +0100)
server/sonar-web/src/main/js/apps/account/profile/Profile.js

index 3d3213b7ea22952b4561a7951868154e11375258..7c4bcd520a196c76eb30398eeb5109f3ccbda4f7 100644 (file)
  * 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 (
         <div className="account-body account-container">
@@ -46,9 +59,12 @@ class Profile extends React.Component {
               </div>
           )}
 
-          <hr className="account-separator"/>
-
-          <UserGroups groups={user.groups}/>
+          {!customOrganizations && (
+              <hr className="account-separator"/>
+          )}
+          {!customOrganizations && (
+              <UserGroups groups={user.groups}/>
+          )}
 
           <hr className="account-separator"/>
 
@@ -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);