core: fix lang list check

pull/584/head
undefined 1 year ago
parent 56fb671c20
commit fa75a0ddda
No known key found for this signature in database

@ -107,8 +107,8 @@ export const FileExistsError = Err('FileExistsError', ForbiddenError, 'File {0}
export const HackFailedError = Err('HackFailedError', ForbiddenError, 'Hack failed: {0}');
export const ProblemAlreadyExistError = Err('ProblemAlreadyExistError', ForbiddenError, 'Problem {0} already exists.');
export const ProblemAlreadyUsedByContestError = Err('ProblemAlreadyUsedByContestError', ForbiddenError, 'Problem {0} is already used by contest {1}.');
export const ProblemNotAllowPretestError = Err('ProblemNotAllowPretestError', ForbiddenError, 'This {0} is not allow run pretest.');
export const ProblemNotAllowLanguageError = Err('ProblemNotAllowSubmitError', ForbiddenError, 'This language is not allow to submit.');
export const ProblemNotAllowPretestError = Err('ProblemNotAllowPretestError', ForbiddenError, 'Pretesting is not supported for {0}.');
export const ProblemNotAllowLanguageError = Err('ProblemNotAllowSubmitError', ForbiddenError, 'This language is not allowed to submit.');
export const HackRejudgeFailedError = Err('HackRejudgeFailedError', BadRequestError, 'Cannot rejudge a hack record.');
export const CannotDeleteSystemDomainError = Err('CannotDeleteSystemDomainError', BadRequestError, 'You are not allowed to delete system domain.');

@ -32,7 +32,7 @@ export function getAvailableLangs(langsList?: string[]) {
const Langs = {};
for (const key in window.LANGS) {
if (prefixes.has(key)) continue;
if (langsList && langsList.length && langsList.join('') && !langsList.includes(key)) continue;
if ((langsList instanceof Array) && !langsList.includes(key)) continue;
if (window.LANGS[key].hidden && !langsList?.includes(key)) continue;
if (window.LANGS[key].disabled) continue;
Langs[key] = window.LANGS[key];

Loading…
Cancel
Save