@@ -12,7 +12,7 @@ import ChallengeStatus from '../ChallengeStatus'
1212import ChallengeTag from '../ChallengeTag'
1313import styles from './ChallengeCard.module.scss'
1414import { formatDate } from '../../../util/date'
15- import { CHALLENGE_STATUS , COMMUNITY_APP_URL , DIRECT_PROJECT_URL , MESSAGE , ONLINE_REVIEW_URL } from '../../../config/constants'
15+ import { CHALLENGE_STATUS , COMMUNITY_APP_URL , DIRECT_PROJECT_URL , MESSAGE , ONLINE_REVIEW_URL , PROJECT_ROLES } from '../../../config/constants'
1616import ConfirmationModal from '../../Modal/ConfirmationModal'
1717import { checkChallengeEditPermission , checkReadOnlyRoles } from '../../../util/tc'
1818import AlertModal from '../../Modal/AlertModal'
@@ -119,7 +119,8 @@ class ChallengeCard extends React.Component {
119119 isDeleteLaunch : false ,
120120 isSaving : false ,
121121 isCheckChalengePermission : false ,
122- hasEditChallengePermission : false
122+ hasEditChallengePermission : false ,
123+ loginUserRoleInProject : ''
123124 }
124125 this . onUpdateConfirm = this . onUpdateConfirm . bind ( this )
125126 this . onUpdateLaunch = this . onUpdateLaunch . bind ( this )
@@ -202,13 +203,13 @@ class ChallengeCard extends React.Component {
202203
203204 render ( ) {
204205 const { isLaunch, isConfirm, isSaving, isDeleteLaunch, isCheckChalengePermission, hasEditChallengePermission } = this . state
205- const { setActiveProject, challenge, reloadChallengeList, isBillingAccountExpired, disableHover, getStatusText, challengeTypes } = this . props
206+ const { setActiveProject, challenge, reloadChallengeList, isBillingAccountExpired, disableHover, getStatusText, challengeTypes, loginUserRoleInProject } = this . props
206207 const deleteMessage = isCheckChalengePermission
207208 ? 'Checking permissions...'
208209 : `Do you want to delete "${ challenge . name } "?`
209210 const orUrl = `${ ONLINE_REVIEW_URL } /review/actions/ViewProjectDetails?pid=${ challenge . legacyId } `
210211 const communityAppUrl = `${ COMMUNITY_APP_URL } /challenges/${ challenge . id } `
211- const isReadOnly = checkReadOnlyRoles ( this . props . auth . token )
212+ const isReadOnly = checkReadOnlyRoles ( this . props . auth . token ) || loginUserRoleInProject === PROJECT_ROLES . READ
212213
213214 return (
214215 < div className = { styles . item } >
@@ -299,7 +300,8 @@ class ChallengeCard extends React.Component {
299300ChallengeCard . defaultPrps = {
300301 reloadChallengeList : ( ) => { } ,
301302 challengeTypes : [ ] ,
302- setActiveProject : ( ) => { }
303+ setActiveProject : ( ) => { } ,
304+ loginUserRoleInProject : ''
303305}
304306
305307ChallengeCard . propTypes = {
@@ -312,7 +314,8 @@ ChallengeCard.propTypes = {
312314 disableHover : PropTypes . bool ,
313315 getStatusText : PropTypes . func ,
314316 challengeTypes : PropTypes . arrayOf ( PropTypes . shape ( ) ) ,
315- auth : PropTypes . object . isRequired
317+ auth : PropTypes . object . isRequired ,
318+ loginUserRoleInProject : PropTypes . string
316319}
317320
318321export default withRouter ( ChallengeCard )
0 commit comments