Skip to content
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