-
Notifications
You must be signed in to change notification settings - Fork 210
[HOTFIX] hide terms for loggedout users #7191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,8 +34,11 @@ export default function ChallengeDetailsView(props) { | |
| setSpecsTabState, | ||
| specsTabState, | ||
| updateChallenge, | ||
| auth, | ||
| } = props; | ||
|
|
||
| const isLoggedIn = !_.isEmpty(auth && auth.tokenV3); | ||
|
|
||
| const { | ||
| groups, | ||
| description, | ||
|
|
@@ -371,7 +374,7 @@ export default function ChallengeDetailsView(props) { | |
| isDevelop={(getTrackName(track) || '').toLowerCase() === 'development'} | ||
| eventDetail={_.isEmpty(events) ? null : events[0]} | ||
| isMM={isMM(challenge)} | ||
| terms={terms} | ||
| terms={isLoggedIn ? terms : []} | ||
| // shareable={_.isEmpty(groups)} | ||
| environment={environment} | ||
| codeRepo={codeRepo} | ||
|
|
@@ -387,6 +390,7 @@ export default function ChallengeDetailsView(props) { | |
| } | ||
|
|
||
| ChallengeDetailsView.defaultProps = { | ||
| auth: {}, | ||
| terms: [], | ||
| challenge: { | ||
| description: undefined, | ||
|
|
@@ -405,6 +409,7 @@ ChallengeDetailsView.defaultProps = { | |
| }; | ||
|
|
||
| ChallengeDetailsView.propTypes = { | ||
| auth: PT.shape(), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| terms: PT.arrayOf(PT.shape()), | ||
| challenge: PT.shape({ | ||
| description: PT.string, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -596,6 +596,7 @@ class ChallengeDetailPageContainer extends React.Component { | |
| !isEmpty && selectedTab === DETAIL_TABS.DETAILS | ||
| && ( | ||
| <ChallengeDetailsView | ||
| auth={auth} | ||
| challenge={challenge} | ||
| challengesUrl={challengesUrl} | ||
| communitiesList={communitiesList.data} | ||
|
|
@@ -738,15 +739,17 @@ class ChallengeDetailPageContainer extends React.Component { | |
| } | ||
| </div> | ||
|
|
||
| <Terms | ||
| defaultTitle="Challenge Prerequisites" | ||
| entity={{ type: 'challenge', id: challengeId.toString(), terms: challenge.terms }} | ||
| instanceId={this.instanceId} | ||
| description="You are seeing these Terms & Conditions because you have registered to a challenge and you have to respect the terms below in order to be able to submit." | ||
| register={() => { | ||
| registerForChallenge(auth, challengeId); | ||
| }} | ||
| /> | ||
| {isLoggedIn && ( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| <Terms | ||
| defaultTitle="Challenge Prerequisites" | ||
| entity={{ type: 'challenge', id: challengeId.toString(), terms: challenge.terms }} | ||
| instanceId={this.instanceId} | ||
| description="You are seeing these Terms & Conditions because you have registered to a challenge and you have to respect the terms below in order to be able to submit." | ||
| register={() => { | ||
| registerForChallenge(auth, challengeId); | ||
| }} | ||
| /> | ||
| )} | ||
|
|
||
| {showSecurityReminder && ( | ||
| <SecurityReminder | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[💡
readability]The expression
auth && auth.tokenV3is used to check ifauthis defined before accessingauth.tokenV3. This is correct, but it could be simplified by using optional chaining:auth?.tokenV3. This would improve readability and reduce potential errors ifauthis undefined.