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:
Stuart Taylor
2018-01-29 16:03:23 +00:00
committed by Quincy Larson
parent 21bd1b4207
commit f9ac50103f
3 changed files with 12 additions and 9 deletions

View File

@ -20,7 +20,7 @@ import {
} from '../../../redux';
import { filesSelector } from '../../../files';
import { makeToast } from '../../../Toasts/redux';
import { setContent } from '../../../../utils/polyvinyl.js';
import { setContent, isPoly } from '../../../../utils/polyvinyl.js';
const legacyPrefixes = [
'Bonfire: ',
@ -55,8 +55,11 @@ function getLegacyCode(legacy) {
}
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 }) {
return actions::ofType(
@ -116,7 +119,7 @@ function loadCodeEpic(actions, { getState }, { window, location }) {
}
const codeFound = getCode(id);
if (codeFound) {
if (codeFound && isPoly(codeFound)) {
finalFiles = codeFound;
} else {
const legacyCode = getLegacyCode(legacyKey);

View File

@ -216,7 +216,10 @@ export const isCodeLockedSelector = state => getNS(state).isCodeLocked;
export const isJSEnabledSelector = state => getNS(state).isJSEnabled;
export const chatRoomSelector = state => getNS(state).helpChatRoom;
export const challengeModalSelector =
state => getNS(state).isChallengeModalOpen;
state => (
getNS(state).isChallengeModalOpen &&
challengeSelector(state).type !== 'backend'
);
export const bugModalSelector = state => getNS(state).isBugOpen;
export const helpModalSelector = state => getNS(state).isHelpOpen;

View File

@ -14,7 +14,6 @@ import SolutionInput from '../../Solution-Input.jsx';
import TestSuite from '../../Test-Suite.jsx';
import Output from '../../Output.jsx';
import {
submitChallenge,
executeChallenge,
testsSelector,
outputSelector
@ -41,7 +40,6 @@ const propTypes = {
executeChallenge: PropTypes.func.isRequired,
id: PropTypes.string,
output: PropTypes.string,
submitChallenge: PropTypes.func.isRequired,
tests: PropTypes.array,
title: PropTypes.string,
...reduxFormPropTypes
@ -75,8 +73,7 @@ const mapStateToProps = createSelector(
);
const mapDispatchToActions = {
executeChallenge,
submitChallenge
executeChallenge
};
export class BackEnd extends PureComponent {