Skip to content

Terms: Hotfix show details before redirect #4999

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

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/shared/containers/terms-detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,25 @@ class TermsDetailPageContainer extends React.Component {
}

componentWillReceiveProps(nextProps) {
const { loadTermDetails, authTokens, termId } = this.props;
const {
loadTermDetails,
authTokens,
termId,
} = this.props;

const {
details,
history,
} = nextProps;

if (!_.isEqual(nextProps.termId, termId)) {
loadTermDetails(authTokens, nextProps.termId);
}

if (details && details.isLegacyTerm && !history.location.pathname.includes(details.id)) {
const path = `/challenges/terms/detail/${details.id}`;
history.push(path, history.state);
}
}

switchHandler() {
Expand Down Expand Up @@ -70,15 +85,9 @@ class TermsDetailPageContainer extends React.Component {
agreeingTerm,
agreeTermFailure,
theme,
history,
} = this.props;
const { termsAccepted, showModal } = this.state;

if (details && details.isLegacyTerm && !history.location.pathname.includes(details.id)) {
const path = `/challenges/terms/detail/${details.id}`;
history.push(path, history.state);
}

return (
<div className={theme['outer-container']}>
{
Expand All @@ -96,7 +105,7 @@ class TermsDetailPageContainer extends React.Component {
) : null
}
{
details
(details && details.text)
? (
<div className={theme['terms-detail-container']}>
<MetaTags title={details.title} description={details.title} />
Expand Down