diff --git a/src/components/ChallengesComponent/ChallengeList/index.js b/src/components/ChallengesComponent/ChallengeList/index.js index 71079d7d..6d0bc806 100644 --- a/src/components/ChallengesComponent/ChallengeList/index.js +++ b/src/components/ChallengesComponent/ChallengeList/index.js @@ -25,7 +25,7 @@ import Loader from '../../Loader' import UpdateBillingAccount from '../../UpdateBillingAccount' import { CHALLENGE_STATUS, PAGE_SIZE, PAGINATION_PER_PAGE_OPTIONS, PROJECT_ROLES } from '../../../config/constants' -import { checkAdmin, checkReadOnlyRoles } from '../../../util/tc' +import { checkAdmin, checkManager, checkReadOnlyRoles } from '../../../util/tc' require('bootstrap/scss/bootstrap.scss') @@ -406,6 +406,9 @@ class ChallengeList extends Component { } = this.props const isReadOnly = checkReadOnlyRoles(this.props.auth.token) || loginUserRoleInProject === PROJECT_ROLES.READ const isAdmin = checkAdmin(this.props.auth.token) + const isManager = checkManager(this.props.auth.token) + const loginUserId = this.props.auth.user.userId + const isMemberOfActiveProject = activeProject && activeProject.members && activeProject.members.some(member => member.userId === loginUserId) if (warnMessage) { return @@ -496,6 +499,8 @@ class ChallengeList extends Component { currentBillingAccount={currentBillingAccount} updateProject={updateProject} projectId={activeProject.id} + isMemberOfActiveProject={isMemberOfActiveProject} + isManager={isManager} /> ) : ( diff --git a/src/components/UpdateBillingAccount/index.js b/src/components/UpdateBillingAccount/index.js index b20cd9b4..d45de764 100644 --- a/src/components/UpdateBillingAccount/index.js +++ b/src/components/UpdateBillingAccount/index.js @@ -17,7 +17,9 @@ const UpdateBillingAccount = ({ isAdmin, currentBillingAccount, projectId, - updateProject + updateProject, + isMemberOfActiveProject, + isManager }) => { const [isEditing, setIsEditing] = useState(false) const [selectedBillingAccount, setSelectedBillingAccount] = useState(null) @@ -129,7 +131,7 @@ const UpdateBillingAccount = ({ !currentBillingAccount && ( No Billing Account set - {isAdmin && ( + {(isAdmin || (isManager && isMemberOfActiveProject)) && ( {' '} ({' '} @@ -153,7 +155,7 @@ const UpdateBillingAccount = ({ > {isBillingAccountExpired ? 'INACTIVE' : 'ACTIVE'} {' '} - {isAdmin && ( + {(isAdmin || (isManager && isMemberOfActiveProject)) && ( {' '} ({' '} @@ -187,7 +189,9 @@ UpdateBillingAccount.propTypes = { isBillingAccountExpired: PropTypes.bool, isAdmin: PropTypes.bool, projectId: PropTypes.number, - updateProject: PropTypes.func.isRequired + updateProject: PropTypes.func.isRequired, + isMemberOfActiveProject: PropTypes.bool.isRequired, + isManager: PropTypes.bool.isRequired } export default UpdateBillingAccount