Skip to content

Remove Mongo URL logging > prod #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
14df18a
TCA-354 - fix handler for external urls when url is fcc lesson
vas3a Sep 5, 2022
82b97c9
Merge pull request #65 from topcoder-platform/TCA-354_fcc-provider-na…
vas3a Sep 6, 2022
6271c97
Removes logging of Mongo URL
testflyjets Sep 6, 2022
3da686f
Merge pull request #66 from topcoder-platform/remove-mongo-url-logging
testflyjets Sep 6, 2022
3579444
TCA-397 #comment This commit adds the gtm module declaration #time 5m
brooketopcoder Sep 6, 2022
95bf94b
TCA-397 #comment This commit adds the pre-commit check back to the de…
brooketopcoder Sep 6, 2022
617639b
TCA-397 #comment This commit adds more loggingn to the call to save a…
brooketopcoder Sep 6, 2022
54b1a70
TCA-397 revert errant changes #time 5m
brooketopcoder Sep 6, 2022
7752094
TCA-385 #comment This commit adds logging #time 5m
brooketopcoder Sep 6, 2022
8f814e6
Merge pull request #68 from topcoder-platform/TCA-397_lint-issues
brooketopcoder Sep 6, 2022
b1c95a3
Merge branch 'dev' into TCA-385_forbidden
brooketopcoder Sep 6, 2022
c9dcaf3
Merge pull request #69 from topcoder-platform/TCA-385_forbidden
brooketopcoder Sep 6, 2022
ee95a5e
Delete Jenkinsfile
Gunasekar-K Sep 7, 2022
7082367
Create Jenkinsfile
Gunasekar-K Sep 7, 2022
e833c37
TCA-397 #comment This commit fixes a lint issue that only appears in …
brooketopcoder Sep 7, 2022
05405ba
Merge pull request #70 from topcoder-platform/TCA-397_lint-issues
brooketopcoder Sep 7, 2022
26d9fdc
TCA-385 #comment This commit adds more logging to the request to save…
brooketopcoder Sep 7, 2022
183c520
Merge pull request #71 from topcoder-platform/TCA-385_forbidden
brooketopcoder Sep 7, 2022
bf5b1c2
TCA-385 #comment This commit adds more logging #time 5m
brooketopcoder Sep 7, 2022
f22345a
Merge pull request #72 from topcoder-platform/TCA-385_forbidden
brooketopcoder Sep 7, 2022
4398cc3
TCA-385 remove extra logging #time 5m
brooketopcoder Sep 9, 2022
934011d
Merge pull request #73 from topcoder-platform/TCA-385_forbidden
brooketopcoder Sep 9, 2022
3289005
TCA-425 - Update backend projects to advance to next lesson without c…
vas3a Sep 15, 2022
d22a7f2
lint
vas3a Sep 15, 2022
09b38a4
Merge pull request #74 from topcoder-platform/TCA-425_update-backend-…
vas3a Sep 15, 2022
479ae53
Merge branch 'prod' into dev
brooketopcoder Sep 15, 2022
0321879
TCA-385 clean up logging #time 15
brooketopcoder Sep 15, 2022
53d7124
Merge pull request #76 from topcoder-platform/TCA-385_forbidden
brooketopcoder Sep 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion api-server/src/server/boot/challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,17 @@ export function isValidChallengeCompletion(req, res, next) {

if (!ObjectID.isValid(id)) {
log('isObjectId', id, ObjectID.isValid(id));
console.debug('isObjectId', id, ObjectID.isValid(id));
return res.status(403).json(isValidChallengeCompletionErrorMsg);
}
if ('challengeType' in req.body && !isNumeric(String(challengeType))) {
log('challengeType', challengeType, isNumeric(challengeType));
console.debug('challengeType', challengeType, isNumeric(challengeType));
return res.status(403).json(isValidChallengeCompletionErrorMsg);
}
if ('solution' in req.body && !isURL(solution)) {
log('isObjectId', id, ObjectID.isValid(id));
log('solution', solution, !isURL(solution));
console.debug('solution', solution, !isURL(solution));
return res.status(403).json(isValidChallengeCompletionErrorMsg);
}
return next();
Expand Down
2 changes: 0 additions & 2 deletions api-server/src/server/middlewares/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const MongoStore = MongoStoreFactory(session);
const sessionSecret = process.env.SESSION_SECRET;
const url = process.env.MONGODB || process.env.MONGOHQ_URL;

console.log('session DB url', url);

export default function sessionsMiddleware() {
return session({
// 900 day session cookie
Expand Down
6 changes: 4 additions & 2 deletions client/src/analytics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import envData from '../../../config/env.json';

const { deploymentEnv } = envData;

const analyticsId =
deploymentEnv === 'staging' ? devAnalyticsId : prodAnalyticsId;
const analyticsId: string =
deploymentEnv === 'staging'
? (devAnalyticsId as string)
: (prodAnalyticsId as string);

ReactGA.initialize(analyticsId);

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/layouts/tc-integration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class TcIntegrationLayout extends Component<TcIntegrationLayoutProps> {
// provider.

// set the pathname for the 2 flavors of lesson URL
const platformPathPrefix = 'learn/freecodecamp';
const platformPathPrefix = 'learn/freeCodeCamp';
const learnPrefix = '/learn/';
let updateHost = false;
if (url.host === `learn.${fccHost}`) {
Expand Down
1 change: 1 addition & 0 deletions client/src/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ declare module '@freecodecamp/strip-comments';
declare module '@types/react-redux';
declare module '@types/validator';
declare module '@types/lodash-es';
declare module 'react-gtm-module';
declare module 'react-lazy-load';
declare module '*.svg' {
const content: string;
Expand Down
53 changes: 29 additions & 24 deletions client/src/templates/Challenges/projects/backend/Show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import {
import ChallengeDescription from '../../components/Challenge-Description';
import Hotkeys from '../../components/Hotkeys';
import ChallengeTitle from '../../components/challenge-title';
import CompletionModal from '../../components/completion-modal';
import HelpModal from '../../components/help-modal';
import Output from '../../components/output';
import TestSuite from '../../components/test-suite';
import {
Expand All @@ -33,12 +31,12 @@ import {
initConsole,
initTests,
isChallengeCompletedSelector,
testsRunningSelector,
updateChallengeMeta,
updateSolutionFormValues
updateSolutionFormValues,
submitChallenge
} from '../../redux';
import { getGuideUrl } from '../../utils';
import SolutionForm from '../solution-form';
import ProjectToolPanel from '../tool-panel';

import '../../components/test-frame.css';

Expand All @@ -48,16 +46,19 @@ const mapStateToProps = createSelector(
challengeTestsSelector,
isChallengeCompletedSelector,
isSignedInSelector,
testsRunningSelector,
(
output: string[],
tests: Test[],
isChallengeCompleted: boolean,
isSignedIn: boolean
isSignedIn: boolean,
testsRunningSelector: boolean
) => ({
tests,
output,
isChallengeCompleted,
isSignedIn
isSignedIn,
testsRunningSelector
})
);

Expand All @@ -67,7 +68,8 @@ const mapDispatchToActions = {
initConsole,
initTests,
updateChallengeMeta,
updateSolutionFormValues
updateSolutionFormValues,
submitChallenge
};

// Types
Expand All @@ -86,8 +88,10 @@ interface BackEndProps {
pageContext: {
challengeMeta: ChallengeMeta;
};
submitChallenge: () => void;
t: TFunction;
tests: Test[];
testsRunning: boolean;
title: string;
updateChallengeMeta: (arg0: ChallengeMeta) => void;
updateSolutionFormValues: () => void;
Expand Down Expand Up @@ -175,24 +179,28 @@ class BackEnd extends Component<BackEndProps> {
}

handleSubmit(): void {
this.props.executeChallenge({
showCompletionModal: false
});
const { tests, submitChallenge } = this.props;
const isChallengeComplete = tests.every(test => test.pass && !test.err);

if (isChallengeComplete) {
submitChallenge();
} else {
this.props.executeChallenge({
showCompletionModal: false
});
}
}

render() {
const {
data: {
challengeNode: {
challenge: {
fields: { blockName },
challengeType,
forumTopicId,
title,
description,
instructions,
translationPending,
certification,
superBlock,
block
}
Expand All @@ -205,9 +213,15 @@ class BackEnd extends Component<BackEndProps> {
},
t,
tests,
testsRunning,
updateSolutionFormValues
} = this.props;

const isChallengeComplete = tests.every(test => test.pass && !test.err);
const submitBtnLabel: string = !isChallengeComplete
? `${t('buttons.run-test')}${testsRunning ? ' ...' : ''}`
: t('buttons.submit-and-go');

const blockNameTitle = `${t(
`intro:${superBlock}.blocks.${block}.title`
)} - ${title}`;
Expand Down Expand Up @@ -243,9 +257,7 @@ class BackEnd extends Component<BackEndProps> {
// eslint-disable-next-line @typescript-eslint/unbound-method
onSubmit={this.handleSubmit}
updateSolutionForm={updateSolutionFormValues}
/>
<ProjectToolPanel
guideUrl={getGuideUrl({ forumTopicId, title })}
buttonLabel={submitBtnLabel}
/>
<br />
<Output
Expand All @@ -260,13 +272,6 @@ class BackEnd extends Component<BackEndProps> {
<TestSuite tests={tests} />
<Spacer />
</Col>
<CompletionModal
block={block}
blockName={blockName}
certification={certification}
superBlock={superBlock}
/>
<HelpModal challengeTitle={title} challengeBlock={blockName} />
</Row>
</Grid>
</LearnLayout>
Expand Down
5 changes: 3 additions & 2 deletions client/src/templates/Challenges/projects/solution-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface SubmitProps {
}

interface FormProps extends WithTranslation {
buttonLabel?: string;
challengeType: number;
description?: string;
onSubmit: (arg0: SubmitProps) => void;
Expand Down Expand Up @@ -46,7 +47,7 @@ export class SolutionForm extends Component<FormProps> {
};

render(): JSX.Element {
const { challengeType, description, t } = this.props;
const { buttonLabel, challengeType, description, t } = this.props;

// back end challenges and front end projects use a single form field
const solutionField = [
Expand All @@ -57,7 +58,7 @@ export class SolutionForm extends Component<FormProps> {
{ name: 'githubLink', label: t('learn.github-link') }
];

const buttonCopy = t('learn.submit-and-go');
const buttonCopy: string = buttonLabel ?? t('learn.submit-and-go');

const options = {
types: {
Expand Down