fix(poly): Check we are working with Poly from code-storage (#16582)
* fix(poly): Check we are working with Poly from code-storage * fix(backend): Do not show complettion modal for a backend challenge * fix(backend): Remove unused action
This commit is contained in:
committed by
Quincy Larson
parent
21bd1b4207
commit
f9ac50103f
@ -20,7 +20,7 @@ import {
|
|||||||
} from '../../../redux';
|
} from '../../../redux';
|
||||||
import { filesSelector } from '../../../files';
|
import { filesSelector } from '../../../files';
|
||||||
import { makeToast } from '../../../Toasts/redux';
|
import { makeToast } from '../../../Toasts/redux';
|
||||||
import { setContent } from '../../../../utils/polyvinyl.js';
|
import { setContent, isPoly } from '../../../../utils/polyvinyl.js';
|
||||||
|
|
||||||
const legacyPrefixes = [
|
const legacyPrefixes = [
|
||||||
'Bonfire: ',
|
'Bonfire: ',
|
||||||
@ -55,8 +55,11 @@ function getLegacyCode(legacy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function legacyToFile(code, files, key) {
|
function legacyToFile(code, files, key) {
|
||||||
return { [key]: setContent(code, files[key]) };
|
if (isPoly(files)) {
|
||||||
}
|
return { [key]: setContent(code, files[key]) };
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function clearCodeEpic(actions, { getState }) {
|
function clearCodeEpic(actions, { getState }) {
|
||||||
return actions::ofType(
|
return actions::ofType(
|
||||||
@ -116,7 +119,7 @@ function loadCodeEpic(actions, { getState }, { window, location }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const codeFound = getCode(id);
|
const codeFound = getCode(id);
|
||||||
if (codeFound) {
|
if (codeFound && isPoly(codeFound)) {
|
||||||
finalFiles = codeFound;
|
finalFiles = codeFound;
|
||||||
} else {
|
} else {
|
||||||
const legacyCode = getLegacyCode(legacyKey);
|
const legacyCode = getLegacyCode(legacyKey);
|
||||||
|
@ -216,7 +216,10 @@ export const isCodeLockedSelector = state => getNS(state).isCodeLocked;
|
|||||||
export const isJSEnabledSelector = state => getNS(state).isJSEnabled;
|
export const isJSEnabledSelector = state => getNS(state).isJSEnabled;
|
||||||
export const chatRoomSelector = state => getNS(state).helpChatRoom;
|
export const chatRoomSelector = state => getNS(state).helpChatRoom;
|
||||||
export const challengeModalSelector =
|
export const challengeModalSelector =
|
||||||
state => getNS(state).isChallengeModalOpen;
|
state => (
|
||||||
|
getNS(state).isChallengeModalOpen &&
|
||||||
|
challengeSelector(state).type !== 'backend'
|
||||||
|
);
|
||||||
|
|
||||||
export const bugModalSelector = state => getNS(state).isBugOpen;
|
export const bugModalSelector = state => getNS(state).isBugOpen;
|
||||||
export const helpModalSelector = state => getNS(state).isHelpOpen;
|
export const helpModalSelector = state => getNS(state).isHelpOpen;
|
||||||
|
@ -14,7 +14,6 @@ import SolutionInput from '../../Solution-Input.jsx';
|
|||||||
import TestSuite from '../../Test-Suite.jsx';
|
import TestSuite from '../../Test-Suite.jsx';
|
||||||
import Output from '../../Output.jsx';
|
import Output from '../../Output.jsx';
|
||||||
import {
|
import {
|
||||||
submitChallenge,
|
|
||||||
executeChallenge,
|
executeChallenge,
|
||||||
testsSelector,
|
testsSelector,
|
||||||
outputSelector
|
outputSelector
|
||||||
@ -41,7 +40,6 @@ const propTypes = {
|
|||||||
executeChallenge: PropTypes.func.isRequired,
|
executeChallenge: PropTypes.func.isRequired,
|
||||||
id: PropTypes.string,
|
id: PropTypes.string,
|
||||||
output: PropTypes.string,
|
output: PropTypes.string,
|
||||||
submitChallenge: PropTypes.func.isRequired,
|
|
||||||
tests: PropTypes.array,
|
tests: PropTypes.array,
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
...reduxFormPropTypes
|
...reduxFormPropTypes
|
||||||
@ -75,8 +73,7 @@ const mapStateToProps = createSelector(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const mapDispatchToActions = {
|
const mapDispatchToActions = {
|
||||||
executeChallenge,
|
executeChallenge
|
||||||
submitChallenge
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export class BackEnd extends PureComponent {
|
export class BackEnd extends PureComponent {
|
||||||
|
Reference in New Issue
Block a user