Skip to content

Commit

Permalink
reverted a couple of changes, fixed edits code agreement checkbox val…
Browse files Browse the repository at this point in the history
…idation, now coercing .env CHALLENGE_INSTRUCTIONS_MIN_LENGTH to number value in instructions schema
  • Loading branch information
AndrewPhilbin committed Feb 16, 2024
1 parent af0baf6 commit 258c744
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,6 @@ export class EditChallenge extends Component {
this.isFinishing = false;
prevStep(stepName);
}}
nextStep={() => {
this.isFinishing = false;
nextStep();
}}
finish={() => {
this.isFinishing = true;
this.handleSubmit();
Expand Down Expand Up @@ -977,10 +973,6 @@ export class EditChallenge extends Component {
this.isFinishing = false;
prevStep(stepName);
}}
nextStep={() => {
this.isFinishing = false;
nextStep();
}}
finish={() => {
this.isFinishing = true;
this.handleSubmit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const jsSchema = (intl) => {
title: intl.formatMessage(messages.automatedEditsCodeLabel),
type: "boolean",
default: false,
enum: [false, true],
enum: [true],
agreementDescription: intl.formatMessage(messages.automatedEditsCodeDescription),
checkboxLabel: messages.automatedEditsCodeUICheckboxLabel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@ import messages from '../Messages'
*
* @author [Neil Rotstan](https://github.com/nrotstan)
*/

const validateMinLength = val => {
if(!isNaN(val)) return val | 0
return 150
}

export const jsSchema = (intl) => {
const instructionsMinLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_MIN_LENGTH || 150
const instructionsMinLength = validateMinLength(process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_MIN_LENGTH)

const schemaFields = {
"$schema": "http://json-schema.org/draft-07/schema#",
type: "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ const newChallengeSteps = {
next: 'AutomatedEditsCodeAgreement',
previous: 'Description',
}),
'AutomatedEditsCodeAgreement': Object.assign({}, automatedEditsCodeAgreementStep, {
next: 'AdvancedOptions',
previous: 'Instructions'
}),
'AdvancedOptions': Object.assign({}, advancedOptionsStep, {
next: [
'Discoverability',
Expand Down Expand Up @@ -236,10 +240,6 @@ const newChallengeSteps = {
previous: 'AdvancedOptions',
canFinish: true,
}),
'AutomatedEditsCodeAgreement': Object.assign({}, automatedEditsCodeAgreementStep, {
next: 'AdvancedOptions',
previous: 'Instructions'
})
}

// String together workflow steps for editing an existing challenge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export default class StepNavigation extends Component {

{_isString(this.props.activeStep.next) &&
<button
type="submit"
className="mr-button mr-button--green-lighter mr-button--with-icon mr-mr-4"
onClick={() => this.props.nextStep()}
>
<FormattedMessage {...messages.next} />
<SvgSymbol
Expand Down

0 comments on commit 258c744

Please sign in to comment.