fix(help): change help button to direct user to correct forum (#284)

* fix(help): change help button to direct user to correct forum

* Refactor category selection to challengeTypes
This commit is contained in:
Oliver Eyton-Williams
2018-09-27 13:41:23 +02:00
committed by Mrugesh Mohapatra
parent cd98a39bfe
commit 3801cecb72
2 changed files with 10 additions and 2 deletions

View File

@ -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=' +

View File

@ -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'
};