mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 18:18:27 -05:00
refactor: remove isPrivate (#61952)
This commit is contained in:
committed by
GitHub
parent
918e0abb9d
commit
12b5905c60
@@ -7,7 +7,6 @@ interface MockChallengeNodes {
|
||||
id: string;
|
||||
block: string;
|
||||
title: string;
|
||||
isPrivate: boolean;
|
||||
superBlock: string;
|
||||
dashedName: string;
|
||||
};
|
||||
@@ -23,7 +22,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'a',
|
||||
block: 'block-a',
|
||||
title: 'Challenge One',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-one',
|
||||
dashedName: 'challenge-one'
|
||||
}
|
||||
@@ -37,7 +35,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'b',
|
||||
block: 'block-a',
|
||||
title: 'Challenge Two',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-one',
|
||||
dashedName: 'challenge-two'
|
||||
}
|
||||
@@ -51,7 +48,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'c',
|
||||
block: 'block-b',
|
||||
title: 'Challenge One',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-one',
|
||||
dashedName: 'challenge-one'
|
||||
}
|
||||
@@ -66,7 +62,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'd',
|
||||
block: 'block-b',
|
||||
title: 'Challenge Two',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-one',
|
||||
dashedName: 'challenge-two'
|
||||
}
|
||||
@@ -80,7 +75,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'e',
|
||||
block: 'block-c',
|
||||
title: 'Challenge One',
|
||||
isPrivate: true,
|
||||
superBlock: 'super-block-one',
|
||||
dashedName: 'challenge-one'
|
||||
}
|
||||
@@ -94,7 +88,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'f',
|
||||
block: 'block-a',
|
||||
title: 'Challenge One',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-two',
|
||||
dashedName: 'challenge-one'
|
||||
}
|
||||
@@ -108,7 +101,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'g',
|
||||
block: 'block-a',
|
||||
title: 'Challenge Two',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-two',
|
||||
dashedName: 'challenge-two'
|
||||
}
|
||||
@@ -122,7 +114,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'h',
|
||||
block: 'block-b',
|
||||
title: 'Challenge One',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-two',
|
||||
dashedName: 'challenge-one'
|
||||
}
|
||||
@@ -136,7 +127,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'i',
|
||||
block: 'block-b',
|
||||
title: 'Challenge Two',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-two',
|
||||
dashedName: 'challenge-two'
|
||||
}
|
||||
@@ -150,7 +140,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'j',
|
||||
block: 'block-a',
|
||||
title: 'Challenge One',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-three',
|
||||
dashedName: 'challenge-one'
|
||||
}
|
||||
@@ -164,7 +153,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'k',
|
||||
block: 'block-c',
|
||||
title: 'Challenge Two',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-three',
|
||||
dashedName: 'challenge-two'
|
||||
}
|
||||
@@ -178,7 +166,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'l',
|
||||
block: 'block-c',
|
||||
title: 'Challenge Three',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-three',
|
||||
dashedName: 'challenge-three'
|
||||
}
|
||||
@@ -192,7 +179,6 @@ const mockChallengeNodes: MockChallengeNodes[] = [
|
||||
id: 'm',
|
||||
block: 'block-a',
|
||||
title: 'Challenge One',
|
||||
isPrivate: false,
|
||||
superBlock: 'super-block-four',
|
||||
dashedName: 'challenge-one'
|
||||
}
|
||||
|
||||
@@ -210,7 +210,6 @@ export type ChallengeNode = {
|
||||
notes: string;
|
||||
prerequisites: PrerequisiteChallenge[];
|
||||
isLocked: boolean;
|
||||
isPrivate: boolean;
|
||||
order: number;
|
||||
questions: Question[];
|
||||
quizzes: Quiz[];
|
||||
|
||||
@@ -63,7 +63,6 @@ const defaultProps = {
|
||||
notes: 'mockNotes',
|
||||
prerequisites: [] as PrerequisiteChallenge[],
|
||||
isLocked: false,
|
||||
isPrivate: false,
|
||||
order: 1,
|
||||
questions: [] as Question[],
|
||||
assignments: ['mockAssignment'],
|
||||
|
||||
@@ -45,7 +45,6 @@ exports.buildChallenges = async function buildChallenges() {
|
||||
}, []);
|
||||
|
||||
const builtChallenges = blocks
|
||||
.filter(block => !block.isPrivate)
|
||||
.map(({ challenges }) => challenges)
|
||||
.reduce((accu, current) => accu.concat(current), []);
|
||||
return builtChallenges;
|
||||
|
||||
@@ -102,8 +102,6 @@ exports.createChallengePages = function (
|
||||
id,
|
||||
isLastChallengeInBlock
|
||||
} = node.challenge;
|
||||
// TODO: challengeType === 7 and isPrivate are the same, right? If so, we
|
||||
// should remove one of them.
|
||||
|
||||
createPage({
|
||||
path: slug,
|
||||
|
||||
@@ -147,7 +147,6 @@ function addMetaToChallenge(challenge, meta) {
|
||||
challenge.superOrder = meta.superOrder;
|
||||
challenge.challengeOrder = challengeOrderIndex;
|
||||
challenge.isLastChallengeInBlock = isLastChallengeInBlock;
|
||||
challenge.isPrivate = challenge.isPrivate || meta.isPrivate;
|
||||
challenge.required = (meta.required || []).concat(challenge.required || []);
|
||||
challenge.template = meta.template;
|
||||
challenge.helpCategory = challenge.helpCategory || meta.helpCategory;
|
||||
|
||||
@@ -3,7 +3,6 @@ id: 688f1daf0133dbe2a36b140b
|
||||
title: A1 Professional Chinese Certification
|
||||
certification: a1-professional-chinese-certification
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 688f1daf0133dbe2a36b140b
|
||||
title: "Dialogue 1: PLACEHOLDER"
|
||||
@@ -3,7 +3,6 @@ id: 651dd7e01d697d0aab7833b7
|
||||
title: A2 English for Developers Certification
|
||||
certification: a2-english-for-developers
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 6721db5d9f0c116e6a0fe25a
|
||||
title: A2 English for Developers Certification Exam
|
||||
|
||||
@@ -3,7 +3,6 @@ id: 682c3153086dd7cabe7f48bc
|
||||
title: A2 Professional Chinese Certification
|
||||
certification: a2-professional-chinese-certification
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 682c2753317b88f1ecdad894
|
||||
title: "Dialogue 1: PLACEHOLDER"
|
||||
|
||||
@@ -3,7 +3,6 @@ id: 681a6b22e5a782fe3459984a
|
||||
title: A2 Professional Spanish Certification
|
||||
certification: a2-professional-spanish-certification
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 681a8796e5a782fe3459984b
|
||||
title: "Dialogue 1: PLACEHOLDER"
|
||||
|
||||
@@ -3,7 +3,6 @@ id: 66607e53317411dd5e8aae21
|
||||
title: B1 English for Developers Certification
|
||||
certification: b1-english-for-developers
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 66607e5b317411dd5e8aae22
|
||||
title: "Dialogue 1: I'm Tom"
|
||||
|
||||
@@ -3,7 +3,6 @@ id: 561add10cb82ac38a17523bc
|
||||
title: Back End Development and APIs Certification
|
||||
certification: back-end-development-and-apis
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: bd7158d8c443edefaeb5bdef
|
||||
title: Timestamp Microservice
|
||||
|
||||
@@ -3,7 +3,6 @@ id: 61531b20cc9dfa2741a5b800
|
||||
title: College Algebra with Python Certification
|
||||
certification: college-algebra-with-python
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 63d83ff239c73468b059cd3f
|
||||
title: Build a Multi-Function Calculator
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 5e46fc95ac417301a38fb934
|
||||
title: Data Analysis with Python Certification
|
||||
certification: data-analysis-with-python
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 5e46f7e5ac417301a38fb928
|
||||
title: Mean-Variance-Standard Deviation Calculator
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 5a553ca864b52e1d8bceea14
|
||||
title: Data Visualization Certification
|
||||
certification: data-visualization
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: bd7168d8c242eddfaeb5bd13
|
||||
title: Visualize Data with a Bar Chart
|
||||
|
||||
@@ -3,7 +3,6 @@ id: 647f7da207d29547b3bee1ba
|
||||
title: Foundational C# with Microsoft Certification
|
||||
certification: foundational-c-sharp-with-microsoft
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 647e22d18acb466c97ccbef8
|
||||
title: Foundational C# with Microsoft Certification Exam
|
||||
|
||||
@@ -3,7 +3,6 @@ id: 561acd10cb82ac38a17513bc
|
||||
title: Front End Development Libraries Certification
|
||||
certification: front-end-development-libraries
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: bd7158d8c442eddfaeb5bd13
|
||||
title: Build a Random Quote Machine
|
||||
|
||||
@@ -3,7 +3,6 @@ id: 64514fda6c245de4d11eb7bb
|
||||
title: Certified Full Stack Developer
|
||||
certification: full-stack-developer
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 645147516c245de4d11eb7ba
|
||||
title: Certified Full Stack Developer Exam
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 5e6021435ac9d0ecd8b94b00
|
||||
title: Information Security Certification
|
||||
certification: information-security
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 587d824a367417b2b2512c44
|
||||
title: Stock Price Checker
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 658180220947283cdc0689ce
|
||||
title: JavaScript Algorithms and Data Structures Certification
|
||||
certification: javascript-algorithms-and-data-structures-v8
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 657bdc55a322aae1eac3838f
|
||||
title: Build a Palindrome Checker
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 561abd10cb81ac38a17513bc
|
||||
title: Legacy JavaScript Algorithms and Data Structures Certification
|
||||
certification: javascript-algorithms-and-data-structures
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: aaa48de84e1ecc7c742e1124
|
||||
title: Palindrome Checker
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 660add10cb82ac38a17513be
|
||||
title: Legacy Back End Certification
|
||||
certification: legacy-back-end
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: bd7158d8c443edefaeb5bdef
|
||||
title: Timestamp Microservice
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 561add10cb82ac39a17513bc
|
||||
title: Legacy Data Visualization Certification
|
||||
certification: legacy-data-visualization
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: bd7157d8c242eddfaeb5bd13
|
||||
title: Build a Markdown Previewer
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 561add10cb82ac38a17513be
|
||||
title: Legacy Front End Certification
|
||||
certification: legacy-front-end
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: bd7158d8c242eddfaeb5bd13
|
||||
title: Build a Personal Portfolio Webpage
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 561add10cb82ac38a17213bd
|
||||
title: Legacy Full Stack Certification
|
||||
certification: legacy-full-stack
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 561add10cb82ac38a17513bc
|
||||
title: Responsive Web Design Certification
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 561add10cb82ac38a17213bc
|
||||
title: Legacy Information Security and Quality Assurance Certification
|
||||
certification: legacy-information-security-and-quality-assurance
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 587d8249367417b2b2512c41
|
||||
title: Metric-Imperial Converter
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 5e46fc95ac417301a38fb935
|
||||
title: Machine Learning with Python Certification
|
||||
certification: machine-learning-with-python
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 5e46f8d6ac417301a38fb92d
|
||||
title: Rock Paper Scissors
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 5e611829481575a52dc59c0e
|
||||
title: Quality Assurance Certification
|
||||
certification: quality-assurance
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 587d8249367417b2b2512c41
|
||||
title: Metric-Imperial Converter
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 606243f50267e718b1e755f4
|
||||
title: Relational Database Certification
|
||||
certification: relational-database
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 5f1a4ef5d5d6b5ab580fc6ae
|
||||
title: Celestial Bodies Database
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 561add10cb82ac38a17513bc
|
||||
title: Responsive Web Design Certification
|
||||
certification: responsive-web-design
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: bd7158d8c442eddfaeb5bd18
|
||||
title: Build a Tribute Page
|
||||
|
||||
@@ -2,7 +2,6 @@ id: 5e44431b903586ffb414c951
|
||||
title: Scientific Computing with Python Certification
|
||||
certification: scientific-computing-with-python
|
||||
challengeType: 7
|
||||
isPrivate: true
|
||||
tests:
|
||||
- id: 5e44412c903586ffb414c94c
|
||||
title: Arithmetic Formatter
|
||||
|
||||
@@ -126,8 +126,7 @@ const quizJoi = Joi.object().keys({
|
||||
.required()
|
||||
});
|
||||
|
||||
const schema = Joi.object()
|
||||
.keys({
|
||||
const schema = Joi.object().keys({
|
||||
block: Joi.string().regex(slugRE).required(),
|
||||
blockId: Joi.objectId(),
|
||||
blockType: Joi.when('superBlock', {
|
||||
@@ -193,7 +192,7 @@ const schema = Joi.object()
|
||||
'Odin',
|
||||
'Euler',
|
||||
'Rosetta'
|
||||
),
|
||||
).required(),
|
||||
isLastChallengeInBlock: Joi.boolean().required(),
|
||||
videoUrl: Joi.string().allow(''),
|
||||
fillInTheBlank: Joi.object().keys({
|
||||
@@ -216,7 +215,6 @@ const schema = Joi.object()
|
||||
}),
|
||||
isComingSoon: Joi.bool(),
|
||||
isLocked: Joi.bool(),
|
||||
isPrivate: Joi.bool(),
|
||||
module: Joi.string().when('superBlock', {
|
||||
is: chapterBasedSuperBlocks,
|
||||
then: Joi.required(),
|
||||
@@ -337,8 +335,7 @@ const schema = Joi.object()
|
||||
then: Joi.string().required()
|
||||
}),
|
||||
usesMultifileEditor: Joi.boolean()
|
||||
})
|
||||
.xor('helpCategory', 'isPrivate');
|
||||
});
|
||||
|
||||
exports.challengeSchemaValidator = () => {
|
||||
return challenge => schema.validate(challenge);
|
||||
|
||||
@@ -27,7 +27,6 @@ interface Challenge {
|
||||
superBlock: string;
|
||||
dashedName: string;
|
||||
solutions: Solution[];
|
||||
isPrivate?: boolean;
|
||||
}
|
||||
|
||||
interface block {
|
||||
|
||||
@@ -61,8 +61,7 @@
|
||||
{
|
||||
"title": "Challenge Nine",
|
||||
"block": "Block One",
|
||||
"superBlock": "super-block-b",
|
||||
"isPrivate": true
|
||||
"superBlock": "super-block-b"
|
||||
},
|
||||
{
|
||||
"title": "Challenge Ten",
|
||||
|
||||
Reference in New Issue
Block a user