fix(api): require fcc repos for coderoad submissions (#50995)

pull/50949/head^2
Oliver Eyton-Williams 2023-07-18 15:48:19 +02:00 committed by GitHub
parent bfecd5091d
commit e9bc3e5968
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -17,7 +17,6 @@ import isURL from 'validator/lib/isURL';
import jwt from 'jsonwebtoken';
import { jwtSecret } from '../../../../config/secrets';
import { environment, deploymentEnv } from '../../../../config/env.json';
import { fixPartiallyCompletedChallengeItem } from '../../common/utils';
import { getChallenges } from '../utils/get-curriculum';
import { ifNoUserSend } from '../utils/middleware';
@ -543,12 +542,8 @@ function createCoderoadChallengeCompleted(app) {
const tutorialRepo = tutorialId?.split(':')[0];
const tutorialOrg = tutorialRepo?.split('/')?.[0];
// this allows any GH account to host the repo in development or staging
// .org submissions should always be from repos hosted on the fCC GH org
if (deploymentEnv !== 'staging' && environment !== 'development') {
if (tutorialOrg !== 'freeCodeCamp')
return res.send('Tutorial not hosted on freeCodeCamp GitHub account');
}
if (tutorialOrg !== 'freeCodeCamp')
return res.send('Tutorial not hosted on freeCodeCamp GitHub account');
// validate tutorial name is in codeRoadChallenges object
const challenge = codeRoadChallenges.find(challenge =>