From ec9cbfdd703bcae8172d88dd2ae9a2f2aa54a5e8 Mon Sep 17 00:00:00 2001 From: gets0ul Date: Fri, 16 Oct 2020 20:50:44 +0700 Subject: [PATCH 1/3] fix: #5082 blank page on clicking challenges tab from stats history page --- src/shared/components/ChallengeTile/index.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/components/ChallengeTile/index.jsx b/src/shared/components/ChallengeTile/index.jsx index c1611df3dd..23810f1ed6 100644 --- a/src/shared/components/ChallengeTile/index.jsx +++ b/src/shared/components/ChallengeTile/index.jsx @@ -2,6 +2,7 @@ * Challenge tile. */ /* eslint-env browser */ +import _ from 'lodash'; import React from 'react'; import PT from 'prop-types'; import { Link } from 'react-router-dom'; @@ -315,7 +316,7 @@ class ChallengeTile extends React.Component { Role:   - { listRoles(challenge.userDetails.roles) } + { listRoles(_.get(challenge, 'userDetails.roles')) } ) } From 3c4498a8ddc5eddde9d39ebde45d2f63660b609e Mon Sep 17 00:00:00 2001 From: gets0ul Date: Mon, 19 Oct 2020 23:19:15 +0700 Subject: [PATCH 2/3] fix: hide roles section if challenge does not have roles data --- src/shared/components/ChallengeTile/index.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/shared/components/ChallengeTile/index.jsx b/src/shared/components/ChallengeTile/index.jsx index 23810f1ed6..0dbc7b7a22 100644 --- a/src/shared/components/ChallengeTile/index.jsx +++ b/src/shared/components/ChallengeTile/index.jsx @@ -75,6 +75,7 @@ class ChallengeTile extends React.Component { } = this.props; const { track, type } = challenge; + const roles = _.get(challenge, 'userDetails.roles'); const outStyleName = `challenge tile-view ${track.replace(' ', '-').toLowerCase()}`; const extraStyle = { @@ -308,19 +309,22 @@ class ChallengeTile extends React.Component { ) } -

- { track !== COMPETITION_TRACKS.DS + { !_.isEmpty(roles) + && ( +

+ { track !== COMPETITION_TRACKS.DS && ( Role:   - { listRoles(_.get(challenge, 'userDetails.roles')) } + { listRoles(roles) } ) } -

+

+ ) } From 38957f2201881eaf9ab67c6d30a6a57d37b3fe38 Mon Sep 17 00:00:00 2001 From: gets0ul Date: Mon, 19 Oct 2020 23:28:08 +0700 Subject: [PATCH 3/3] fix: test snapshot --- .../components/ChallengeTile/__snapshots__/index.jsx.snap | 3 --- 1 file changed, 3 deletions(-) diff --git a/__tests__/shared/components/ChallengeTile/__snapshots__/index.jsx.snap b/__tests__/shared/components/ChallengeTile/__snapshots__/index.jsx.snap index c733309a43..9fe1f038fa 100644 --- a/__tests__/shared/components/ChallengeTile/__snapshots__/index.jsx.snap +++ b/__tests__/shared/components/ChallengeTile/__snapshots__/index.jsx.snap @@ -241,9 +241,6 @@ exports[`renders marathon 1`] = `

-