@@ -12,7 +12,7 @@ import ChallengeStatus from '../ChallengeStatus'
12
12
import ChallengeTag from '../ChallengeTag'
13
13
import styles from './ChallengeCard.module.scss'
14
14
import { 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'
16
16
import ConfirmationModal from '../../Modal/ConfirmationModal'
17
17
import { checkChallengeEditPermission , checkReadOnlyRoles } from '../../../util/tc'
18
18
import AlertModal from '../../Modal/AlertModal'
@@ -119,7 +119,8 @@ class ChallengeCard extends React.Component {
119
119
isDeleteLaunch : false ,
120
120
isSaving : false ,
121
121
isCheckChalengePermission : false ,
122
- hasEditChallengePermission : false
122
+ hasEditChallengePermission : false ,
123
+ loginUserRoleInProject : ''
123
124
}
124
125
this . onUpdateConfirm = this . onUpdateConfirm . bind ( this )
125
126
this . onUpdateLaunch = this . onUpdateLaunch . bind ( this )
@@ -202,13 +203,13 @@ class ChallengeCard extends React.Component {
202
203
203
204
render ( ) {
204
205
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
206
207
const deleteMessage = isCheckChalengePermission
207
208
? 'Checking permissions...'
208
209
: `Do you want to delete "${ challenge . name } "?`
209
210
const orUrl = `${ ONLINE_REVIEW_URL } /review/actions/ViewProjectDetails?pid=${ challenge . legacyId } `
210
211
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
212
213
213
214
return (
214
215
< div className = { styles . item } >
@@ -299,7 +300,8 @@ class ChallengeCard extends React.Component {
299
300
ChallengeCard . defaultPrps = {
300
301
reloadChallengeList : ( ) => { } ,
301
302
challengeTypes : [ ] ,
302
- setActiveProject : ( ) => { }
303
+ setActiveProject : ( ) => { } ,
304
+ loginUserRoleInProject : ''
303
305
}
304
306
305
307
ChallengeCard . propTypes = {
@@ -312,7 +314,8 @@ ChallengeCard.propTypes = {
312
314
disableHover : PropTypes . bool ,
313
315
getStatusText : PropTypes . func ,
314
316
challengeTypes : PropTypes . arrayOf ( PropTypes . shape ( ) ) ,
315
- auth : PropTypes . object . isRequired
317
+ auth : PropTypes . object . isRequired ,
318
+ loginUserRoleInProject : PropTypes . string
316
319
}
317
320
318
321
export default withRouter ( ChallengeCard )
0 commit comments