Skip to content

Fix submit blank issue #4172

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 2 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ workflows:
filters:
branches:
only:
- hot-fix-submit-blank
- develop
# This is alternate dev env for parallel testing
- "build-test":
Expand All @@ -189,7 +190,7 @@ workflows:
filters:
branches:
only:
- develop
- notifications-analytics
# Production builds are exectuted only on tagged commits to the
# master branch.
- "build-prod":
Expand Down
3 changes: 3 additions & 0 deletions src/shared/components/tc-communities/AccessDenied/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default function AccessDenied(props) {
<div styleName="msg">
You are not authorized to access this page.
</div>
{props.children}
</div>
);
case CAUSE.HAVE_NOT_SUBMITTED_TO_THE_CHALLENGE:
Expand Down Expand Up @@ -94,6 +95,7 @@ AccessDenied.defaultProps = {
spaceName: null,
environment: null,
viewportId: null,
children: null,
};

AccessDenied.propTypes = {
Expand All @@ -103,4 +105,5 @@ AccessDenied.propTypes = {
spaceName: PT.string,
environment: PT.string,
viewportId: PT.string,
children: PT.node,
};
15 changes: 12 additions & 3 deletions src/shared/containers/SubmissionPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
import actions from 'actions/page/submission';
import communityActions from 'actions/tc-communities';
import { PrimaryButton } from 'topcoder-react-ui-kit';
import shortId from 'shortid';
import React from 'react';
import PT from 'prop-types';
Expand Down Expand Up @@ -50,9 +51,17 @@ class SubmissionsPageContainer extends React.Component {
}

render() {
const { registrants, handle } = this.props;
const { registrants, handle, challengeId } = this.props;
const isRegistered = registrants.find(r => _.toString(r.handle) === _.toString(handle));
if (!isRegistered) return <AccessDenied cause={ACCESS_DENIED_REASON.NOT_AUTHORIZED} />;
if (!isRegistered) {
return (
<React.Fragment>
<AccessDenied cause={ACCESS_DENIED_REASON.NOT_AUTHORIZED}>
<PrimaryButton to={`/challenges/${challengeId}`}>Go to Challenge Details</PrimaryButton>
</AccessDenied>
</React.Fragment>
);
}
return (
<SubmissionsPage
{...this.props}
Expand Down Expand Up @@ -144,7 +153,7 @@ const mapStateToProps = (state, ownProps) => {
allPhases: state.challenge.details.allPhases,
communitiesList: state.tcCommunities.list,
/* Older stuff below. */
userId: state.auth.user.userId,
userId: state.auth.user ? state.auth.user.userId : '',
challengeId: state.challenge.details.id,
challengeName: state.challenge.details.name,
challengesUrl: ownProps.challengesUrl,
Expand Down