diff --git a/packages/learn/src/templates/Challenges/redux/create-question-epic.js b/packages/learn/src/templates/Challenges/redux/create-question-epic.js index 4a2aa9074f..27f01d5e5c 100644 --- a/packages/learn/src/templates/Challenges/redux/create-question-epic.js +++ b/packages/learn/src/templates/Challenges/redux/create-question-epic.js @@ -7,6 +7,7 @@ import { } from '../redux'; import { tap } from 'rxjs/operators/tap'; import { mapTo } from 'rxjs/operators/mapTo'; +import { helpCategory } from '../../../../utils/challengeTypes'; function filesToMarkdown(files = {}) { const moreThenOneFile = Object.keys(files).length > 1; @@ -53,11 +54,10 @@ function createQuestionEpic(action$, { getState }, { window }) { '**Link to the challenge:**\n', href ].join(''); - const categories = ['HTML-CSS', 'JavaScript']; window.open( 'https://forum.freecodecamp.org/new-topic' + '?category=' + - window.encodeURIComponent(categories[challengeType] || 'Help') + + window.encodeURIComponent(helpCategory[challengeType] || 'Help') + '&title=' + window.encodeURIComponent(challengeTitle) + '&body=' + diff --git a/packages/learn/utils/challengeTypes.js b/packages/learn/utils/challengeTypes.js index 166f62d5a7..d4abcc77f0 100644 --- a/packages/learn/utils/challengeTypes.js +++ b/packages/learn/utils/challengeTypes.js @@ -65,3 +65,11 @@ exports.submitTypes = { [backend]: 'backend', [modern]: 'tests' }; + +// determine which help forum questions should be posted to +exports.helpCategory = { + [html]: 'HTML-CSS', + [js]: 'JavaScript', + [backend]: 'JavaScript', + [modern]: 'JavaScript' +};