@@ -5,7 +5,10 @@ import { connect } from 'react-redux'
55import _ from 'lodash'
66import { renderComponent , branch , compose , withProps } from 'recompose'
77import { loadProjectDashboard } from '../actions/projectDashboard'
8- import { LOAD_PROJECT_FAILURE , PROJECT_ROLE_CUSTOMER , PROJECT_ROLE_OWNER } from '../../config/constants'
8+ import {
9+ LOAD_PROJECT_FAILURE , PROJECT_ROLE_CUSTOMER , PROJECT_ROLE_OWNER ,
10+ ROLE_ADMINISTRATOR , ROLE_CONNECT_MANAGER
11+ } from '../../config/constants'
912import spinnerWhileLoading from '../../components/LoadingSpinner'
1013import CoderBot from '../../components/CoderBot/CoderBot'
1114
@@ -26,7 +29,8 @@ const ProjectDetailView = (props) => {
2629 const children = React . Children . map ( props . children , ( child ) => {
2730 return React . cloneElement ( child , {
2831 project : props . project ,
29- currentMemberRole : props . currentMemberRole
32+ currentMemberRole : props . currentMemberRole ,
33+ isManager : props . isManager
3034 } )
3135 } )
3236 return < div > { children } </ div >
@@ -67,7 +71,15 @@ class ProjectDetail extends Component {
6771
6872 render ( ) {
6973 const currentMemberRole = this . getProjectRoleForCurrentUser ( this . props )
70- return < EnhancedProjectDetailView { ...this . props } currentMemberRole = { currentMemberRole } />
74+ const managerRoles = [ ROLE_ADMINISTRATOR , ROLE_CONNECT_MANAGER ]
75+ const isManager = this . props . currentUserRoles . some ( ( role ) => managerRoles . indexOf ( role ) !== - 1 )
76+ return (
77+ < EnhancedProjectDetailView
78+ { ...this . props }
79+ currentMemberRole = { currentMemberRole }
80+ isManager = { isManager }
81+ />
82+ )
7183 }
7284}
7385
@@ -77,9 +89,11 @@ const mapStateToProps = ({projectState, projectDashboard, loadUser}) => {
7789 isLoading : projectDashboard . isLoading ,
7890 isProcessing : projectState . processing ,
7991 error : projectState . error ,
80- project : projectState . project
92+ project : projectState . project ,
93+ currentUserRoles : loadUser . user . roles
8194 }
8295}
96+
8397const mapDispatchToProps = { loadProjectDashboard }
8498
8599ProjectDetail . propTypes = {
0 commit comments