From 3a2aa57c7119c20aad1168500ca1431f67288318 Mon Sep 17 00:00:00 2001 From: CollinBeczak Date: Wed, 10 Jan 2024 23:25:43 -0600 Subject: [PATCH] update variable names for instruction minimum length environment variable --- .env | 2 +- .../EditChallenge/BulkSchemas/InstructionsSchema.js | 6 +++--- .../Manage/ManageChallenges/EditChallenge/Messages.js | 2 +- .../EditChallenge/Schemas/InstructionsSchema.js | 4 ++-- src/services/Challenge/Challenge.js | 4 ++-- src/services/Error/Messages.js | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.env b/.env index 7f4c089a0..b81756ab8 100644 --- a/.env +++ b/.env @@ -196,4 +196,4 @@ REACT_APP_DISABLE_TASK_CLUSTERS='' REACT_APP_DISABLE_USER_LEADERBOARD_CONFIGS='' # For setting the minimum character count for challenge instructions -REACT_APP_CHALLENGE_INSTRUCTIONS_LENGTH=150 +REACT_APP_CHALLENGE_INSTRUCTIONS_MIN_LENGTH=150 diff --git a/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/BulkSchemas/InstructionsSchema.js b/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/BulkSchemas/InstructionsSchema.js index 4a923327b..d49edb38d 100644 --- a/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/BulkSchemas/InstructionsSchema.js +++ b/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/BulkSchemas/InstructionsSchema.js @@ -1,7 +1,7 @@ import messages from '../Messages' export const jsSchema = (intl) => { - const instructionsLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_LENGTH || 150 + const instructionsMinLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_MIN_LENGTH || 150 const schemaFields = { "$schema": "http://json-schema.org/draft-07/schema#", type: "object", @@ -9,8 +9,8 @@ export const jsSchema = (intl) => { instruction: { title: intl.formatMessage(messages.instructionLabel), type: "string", - minLength: instructionsLength, - description: intl.formatMessage(messages.instructionsDescription, {details: `${instructionsLength}`}) + minLength: instructionsMinLength, + description: intl.formatMessage(messages.instructionsDescription, {minLength: `${instructionsMinLength}`}) }, }, } diff --git a/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/Messages.js b/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/Messages.js index cbe40074e..82139c939 100644 --- a/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/Messages.js +++ b/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/Messages.js @@ -765,7 +765,7 @@ will not be able to make sense of it. instructionsDescription: { id: "Admin.EditChallenge.form.instructionsDescription", - defaultMessage: "Instructions must be longer than {details} characters.", + defaultMessage: "Instructions must be longer than {minLength} characters.", }, nameDescription: { diff --git a/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/Schemas/InstructionsSchema.js b/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/Schemas/InstructionsSchema.js index 21811c429..059785b5f 100644 --- a/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/Schemas/InstructionsSchema.js +++ b/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/Schemas/InstructionsSchema.js @@ -17,7 +17,7 @@ import messages from '../Messages' * @author [Neil Rotstan](https://github.com/nrotstan) */ export const jsSchema = (intl) => { - const instructionsLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_LENGTH || 150 + const instructionsMinLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_MIN_LENGTH || 150 const schemaFields = { "$schema": "http://json-schema.org/draft-07/schema#", type: "object", @@ -26,7 +26,7 @@ export const jsSchema = (intl) => { title: intl.formatMessage(messages.instructionLabel), type: "string", minLength: instructionsLength, - description: intl.formatMessage(messages.instructionsDescription, {details: `${instructionsLength}`}) + description: intl.formatMessage(messages.instructionsDescription, {minLength: `${instructionsMinLength}`}) }, difficulty: { title: intl.formatMessage(messages.difficultyLabel), diff --git a/src/services/Challenge/Challenge.js b/src/services/Challenge/Challenge.js index a4057616c..e7af20264 100644 --- a/src/services/Challenge/Challenge.js +++ b/src/services/Challenge/Challenge.js @@ -1044,7 +1044,7 @@ export const fetchChallenges = function ( name } = challengeData; - const instructionsLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_LENGTH || 150 + const instructionsMinLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_MIN_LENGTH || 150 if ( challengeData.parent != undefined && ( @@ -1066,7 +1066,7 @@ export const fetchChallenges = function ( instruction.length < 150 ) { errorMessage = AppErrors.challengeSaveFailure.saveInstructionsFailure; - errorMessage.values = { details: `${instructionsLength}` }; + errorMessage.values = { minLength: `${instructionsMinLength}` }; } else { errorMessage = AppErrors.challengeSaveFailure.saveDetailsFailure; } diff --git a/src/services/Error/Messages.js b/src/services/Error/Messages.js index 655e3b44e..76a2d3db7 100644 --- a/src/services/Error/Messages.js +++ b/src/services/Error/Messages.js @@ -203,7 +203,7 @@ export default defineMessages({ }, challengeSaveInstructionFailure: { id: "Errors.challengeSaveFailure.challengeSaveInstructionFailure", - defaultMessage: "The 'DETAILED INSTRUCTIONS FOR MAPPERS' field must have more than {details} characters.", + defaultMessage: "The 'DETAILED INSTRUCTIONS FOR MAPPERS' field must have more than {minLength} characters.", }, challengeSaveEditPolicyAgreementFailure: { id: "Errors.challengeSaveFailure.challengeSaveEditPolicyAgreementFailure",