Skip to content

Commit 3c464c0

Browse files
authored
Merge pull request #1640 from topcoder-platform/pm-574
fix(PM-574): show update/add billing address for project manager who belongs to the project
2 parents bbe6312 + 997d8f0 commit 3c464c0

File tree

2 files changed

+14
-5
lines changed
  • src/components

2 files changed

+14
-5
lines changed

src/components/ChallengesComponent/ChallengeList/index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Loader from '../../Loader'
2525
import UpdateBillingAccount from '../../UpdateBillingAccount'
2626

2727
import { CHALLENGE_STATUS, PAGE_SIZE, PAGINATION_PER_PAGE_OPTIONS, PROJECT_ROLES } from '../../../config/constants'
28-
import { checkAdmin, checkReadOnlyRoles } from '../../../util/tc'
28+
import { checkAdmin, checkManager, checkReadOnlyRoles } from '../../../util/tc'
2929

3030
require('bootstrap/scss/bootstrap.scss')
3131

@@ -406,6 +406,9 @@ class ChallengeList extends Component {
406406
} = this.props
407407
const isReadOnly = checkReadOnlyRoles(this.props.auth.token) || loginUserRoleInProject === PROJECT_ROLES.READ
408408
const isAdmin = checkAdmin(this.props.auth.token)
409+
const isManager = checkManager(this.props.auth.token)
410+
const loginUserId = this.props.auth.user.userId
411+
const isMemberOfActiveProject = activeProject && activeProject.members && activeProject.members.some(member => member.userId === loginUserId)
409412

410413
if (warnMessage) {
411414
return <Message warnMessage={warnMessage} />
@@ -496,6 +499,8 @@ class ChallengeList extends Component {
496499
currentBillingAccount={currentBillingAccount}
497500
updateProject={updateProject}
498501
projectId={activeProject.id}
502+
isMemberOfActiveProject={isMemberOfActiveProject}
503+
isManager={isManager}
499504
/>
500505
</div>
501506
) : (

src/components/UpdateBillingAccount/index.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ const UpdateBillingAccount = ({
1717
isAdmin,
1818
currentBillingAccount,
1919
projectId,
20-
updateProject
20+
updateProject,
21+
isMemberOfActiveProject,
22+
isManager
2123
}) => {
2224
const [isEditing, setIsEditing] = useState(false)
2325
const [selectedBillingAccount, setSelectedBillingAccount] = useState(null)
@@ -129,7 +131,7 @@ const UpdateBillingAccount = ({
129131
!currentBillingAccount && (
130132
<Fragment>
131133
<span className={styles.error}>No Billing Account set</span>
132-
{isAdmin && (
134+
{(isAdmin || (isManager && isMemberOfActiveProject)) && (
133135
<span>
134136
{' '}
135137
({' '}
@@ -153,7 +155,7 @@ const UpdateBillingAccount = ({
153155
>
154156
{isBillingAccountExpired ? 'INACTIVE' : 'ACTIVE'}
155157
</span>{' '}
156-
{isAdmin && (
158+
{(isAdmin || (isManager && isMemberOfActiveProject)) && (
157159
<span>
158160
{' '}
159161
({' '}
@@ -187,7 +189,9 @@ UpdateBillingAccount.propTypes = {
187189
isBillingAccountExpired: PropTypes.bool,
188190
isAdmin: PropTypes.bool,
189191
projectId: PropTypes.number,
190-
updateProject: PropTypes.func.isRequired
192+
updateProject: PropTypes.func.isRequired,
193+
isMemberOfActiveProject: PropTypes.bool.isRequired,
194+
isManager: PropTypes.bool.isRequired
191195
}
192196

193197
export default UpdateBillingAccount

0 commit comments

Comments
 (0)