Skip to content

Commit e7f5286

Browse files
Challenge Details : Fix isRegistered functions
1 parent 3eb060a commit e7f5286

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/shared/containers/SubmissionManagement/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class SubmissionManagementPageContainer extends React.Component {
6565
showModal,
6666
toBeDeletedId,
6767
} = this.props;
68-
const isRegistered = registrants.find(r => _.toString(r.handle) === _.toString(handle));
68+
const isRegistered = registrants.find(r => _.toString(r.memberHandle) === _.toString(handle));
6969
if (!isRegistered) return <AccessDenied redirectLink={`${challengesUrl}/${challenge.id}`} cause={ACCESS_DENIED_REASON.HAVE_NOT_SUBMITTED_TO_THE_CHALLENGE} />;
7070

7171
const isEmpty = _.isEmpty(challenge);

src/shared/containers/SubmissionPage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class SubmissionsPageContainer extends React.Component {
5353

5454
render() {
5555
const { registrants, handle, challengeId } = this.props;
56-
const isRegistered = registrants.find(r => _.toString(r.handle) === _.toString(handle));
56+
const isRegistered = registrants.find(r => _.toString(r.memberHandle) === _.toString(handle));
5757
if (!isRegistered) {
5858
return (
5959
<React.Fragment>

src/shared/containers/challenge-detail/index.jsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,8 @@ function getOgImage(challenge, challengeTypes) {
112112
}
113113
}
114114

115-
function isRegistered(details, registrants, handle) {
116-
if (details && details.roles && details.roles.includes('Submitter')) {
117-
return true;
118-
}
119-
if (_.find(registrants, r => _.toString(r.handle) === _.toString(handle))) {
115+
function isRegistered(registrants, handle) {
116+
if (_.find(registrants, r => _.toString(r.memberHandle) === _.toString(handle))) {
120117
return true;
121118
}
122119
return false;
@@ -398,7 +395,6 @@ class ChallengeDetailPageContainer extends React.Component {
398395
const isLegacyMM = isMM(challenge) && Boolean(challenge.roundId);
399396

400397
const hasRegistered = isRegistered(
401-
challenge.userDetails,
402398
challenge.registrants,
403399
(auth.user || {}).handle,
404400
);

0 commit comments

Comments
 (0)